public ActionResult FindCustomer(Customer customer, string loginEmail) { if(Request.Form["SubmitLogin"] != null) { customer = Facade.GetCustomerGateway().search(loginEmail); if(customer == null) { ViewBag.LoginError = "Ingen kunde fundet på emailen."; return View(); } else { return RedirectToAction("PlaceOrder", customer); } } else if(Request.Form["SubmitCreate"] != null) { if (ModelState.IsValid) { return RedirectToAction("PlaceOrder", customer); } else { return View(); } } return View(); }
public ActionResult Create(Customer customer) { if (ModelState.IsValid) { Facade.GetCustomerRepository().Create(customer); return RedirectToAction("Index"); } CreateEditCustomerViewModel createEditCustomerViewModel = new CreateEditCustomerViewModel(); return View(createEditCustomerViewModel); }
public ActionResult PlaceOrder(Customer customer) { if(Session["Cart"] == null) { return RedirectToAction("Index"); } Orders order = new Orders(); order.customer = customer; order.orderTime = DateTime.Now; order.shoppingCartItems = (List<ShoppingCartItem>)Session["Cart"]; Facade.GetOrderGateway().Create(order); Session["Cart"] = null; return View(); }