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)); } }
public void CreateOrder() { mock.Setup(x => x.Carts); ServiceCart serviceCart = new ServiceCart(mock.Object); int res = serviceCart.GetCreateOrder(null); }