public ActionResult BillingInfo(BillingInfo BillingInfo) { if (ModelState.IsValid) { ShoppingCartModel cart = GetCart(); cart.BillingInfo = BillingInfo; ProcessOrder(cart); cart.Clear(); return(RedirectToAction("OrderComplete")); } else { return(View(BillingInfo)); } }
public ViewResult BillingInfo(BillingInfo billingInfo) { if (ModelState.IsValid) { ShoppingCartModel cart = GetCart(); cart.BillingInfo = billingInfo; ProcessOrder(cart); cart.Clear(); return(View("OrderComplete")); } else { return(View(billingInfo)); } }
public ActionResult ProcessOrder(ContactViewModel contactModel, string returnUrl) { if (ModelState.IsValid) { ShoppingCartModel cart = GetCart(); var model = new CreateOrderViewModel { Cart = cart, OrderInfo = contactModel, }; model.OrderInfo.Comment = contactModel.Comment; apiModelOrder.SaveOrderToDb("api/APIDbOrder", model); cart.Clear(); return(PartialView("_ThankYou")); } apiModelPayment.Payments = apiModelPayment.GetAllPaymentsFromDb("api/APIDbPayment"); contactModel.PaymentTypeList = apiModelPayment.Payments; apiModelDelivery.Deliveries = apiModelDelivery.GetAllDeliveriesFromDb("api/APIDbDelivery"); contactModel.DeliveryTypeList = apiModelDelivery.Deliveries; return(PartialView("OrderDetails", contactModel)); }
private void ClearCart(ShoppingCartModel cart) { cart.Clear(); }