MVC在control内传递AJAX

前端之家收集整理的这篇文章主要介绍了MVC在control内传递AJAX前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

前台

//重新提交审核
    function ReConfirm(OrderId) {
        $.ajax({
            type: "POST",dataType: "text",url: "/UserCenter/UpdateOrderStatus",data: { OrderId: OrderId,Action: "ReConfirm" },success: function (data) {
                if (data != "NO") {
                    $("#Status_" + OrderId).css("color","black").text("未下载");
                    $(".h2Tip").css("display","none");
                } else {
                    ShowFailTip("@V5print.WebFile.LangHelper.Lang("common","ServerBusyTryLatter")");
                }
            }
        });
    }

后台

//更改订单状态
        [HttpPost]
        public ActionResult UpdateOrderStatus(FormCollection Fm)
        {
            V5print.BLL.Shop.Order.OrderItems itemBll = new V5print.BLL.Shop.Order.OrderItems();
            //_orderManage;
            if (string.IsNullOrWhiteSpace(Fm["OrderId"]) || string.IsNullOrWhiteSpace(Fm["OrderId"]))
            {
                return base.Content("No");
            }
            string action = Globals.SafeString(Fm["Action"],"");
            long OrderId = Globals.SafeLong(Fm["OrderId"],0L);

            //确认收货
            if (action == "Received")
            {
                if (base.CurrentUser != null)
                {
                    int UserId = base.CurrentUser.UserID;
                    int ShippingStatus = (int)V5print.Model.Shop.Order.EnumHelper.ShippingStatus.ConfirmShip;
                    if (_orderManage.UpdateShippingStatus(OrderId,ShippingStatus,UserId,DateTime.Now))
                    {
                        return base.Content("Yes");
                    }
                    else
                    {
                        return base.Content("No");
                    }
                }
                else 
                {
                    return base.Content("No");
                }
            }
            //取消
            else if (action == "Cancel")
            {
                if (base.CurrentUser != null)
                {
                    int Status = (int)V5print.Model.Shop.Order.EnumHelper.OrderStatus.Cancel;
                    if (_orderManage.UpdateOrderStatus(OrderId,Status))
                    {
                        return base.Content("Yes");
                    }
                    else
                    {
                        return base.Content("No");
                    }
                }
                else
                {
                    return base.Content("No");
                }
            }
            //重新提交审核
            else if (action == "ReConfirm")
            {
                if (base.CurrentUser != null)
                {
                    V5print.Model.Shop.Order.OrderInfo order = this._orderManage.GetModel(OrderId);
                    order.DownloadStatus = (int)V5print.Model.Shop.Order.EnumHelper.DownloadStatus.UnDownload;
                    order.ConfirmStatus = (int)V5print.Model.Shop.Order.EnumHelper.ConfirmStatus.UnConfirm;
                    if (_orderManage.Update(order))
                    {
                        return base.Content("Yes");
                    }
                    else
                    {
                        return base.Content("No");
                    }
                }
                else
                {
                    return base.Content("No");
                }
            }

            return base.Content("No");
        }
原文链接:https://www.f2er.com/ajax/162478.html

猜你在找的Ajax相关文章