예제 #1
0
        public ActionResult Index(OrderViewModel model)
        {
            OrderDTO orderDTO = new OrderDTO();

            TryUpdateModel(orderDTO);
            if (ModelState.IsValid)
            {
                ServiceCart cart = serviceCart.GetCart(this.HttpContext);

                orderDTO.OrderDate = DateTime.Now;
                orderDTO.Total     = cart.GetTotalFromCart();
                orderDTO.Username  = User.Identity.Name;


                serviceOrder.CreateOrder(orderDTO);
                cart.GetCreateOrder(orderDTO);


                return(RedirectToAction("index", "home"));
            }
            else
            {
                ViewBag.Error = "Error";
                ModelState.AddModelError("", "Not correct datas!");
                return(View(model));
            }
        }
예제 #2
0
 public void CreateOrder()
 {
     mock.Setup(x => x.Carts);
     ServiceCart serviceCart = new ServiceCart(mock.Object);
     int         res         = serviceCart.GetCreateOrder(null);
 }