Exemple #1
0
        public ActionResult ChangeShippingMethod(long id)
        {
            //var checkout = Session["checkout"] as CheckOutDTO;
            var result = new OperationDetails(true, "تم تعديل الطريقة بنجاح", "");

            if (id == 0)
            {
                //checkout.ShippingMethod = Common.ShippingMethods.Free;
                result = _checkOutService.SetShippingMethod(User.Identity.GetUserId(), Common.ShippingMethods.Free);
            }
            else if (id == -1)
            {
                //checkout.ShippingMethod = Common.ShippingMethods.ByHand;
                result = _checkOutService.SetShippingMethod(User.Identity.GetUserId(), Common.ShippingMethods.ByHand);
            }
            else
            {
                //checkout.ShippingMethod = Common.ShippingMethods.WithCompany;
                result = _checkOutService.SetShippingMethod(User.Identity.GetUserId(), Common.ShippingMethods.WithCompany);

                if (result.Succedeed)
                {
                    result = _checkOutService.SetShippingCompany(User.Identity.GetUserId(), id);
                }
                //checkout.SelectShippingCompany = checkout.ShippingCompanies.Where(sc => sc.Id == id).FirstOrDefault();
                //checkout.TotalCost = checkout.SelectShippingCompany.ShippingCost + checkout.SubTotalCost;
            }
            //Session["checkout"] = checkout;

            return(Json(result));
        }