Exemplo n.º 1
0
        public ActionResult SaveOrder()
        {
            int numberofOrder = _iOrderService.CountOrderOnDay() + 1;
            List <ShoppingCartViewModel> lst = Session["Cart"] as List <ShoppingCartViewModel>;
            decimal total = 0;

            foreach (ShoppingCartViewModel item in lst)
            {
                total += item.SubTotal;
            }
            OrderViewModel viewModel = new OrderViewModel();

            viewModel = Session["InfoOrder"] as OrderViewModel;
            DateTime d = DateTime.Today;

            viewModel.OrderCode   = Extentions.AutoID("DH-" + d.Year + d.Month + d.Day, numberofOrder);
            viewModel.Status      = 0;
            viewModel.TypePayment = 1;
            viewModel.TotalMoney  = total;
            _iOrderService.InsertOrder(viewModel);
            SaveDetailOrder(lst, viewModel.Id);
            Session.Remove("Cart");
            Session.Remove("InfoOrder");
            JsonClasses cls = new JsonClasses()
            {
                Status = true
            };

            return(Json(cls));
        }