public ActionResult RegisterCustomer([Bind(Exclude = "ID")] Customer customer) { if(!ModelState.IsValid) { Session["CustomerEmail"] = null; return RedirectToAction("RegisterCustomer"); } Customer newCustomer = new Customer() { firstName = customer.firstName, lastName = customer.lastName, email = customer.email, password = customer.password, adress = customer.adress, zipCode = customer.zipCode, area = customer.area }; if(new DACustomer().registerNewCustomer(newCustomer)) { Session["CustomerEmail"] = customer.email; return RedirectToAction("Index", "MyAccount", new { area = "AuthenticatedCustomer" }); } else { Session["CustomerEmail"] = null; return RedirectToAction("RegisterCustomer"); } }
public ActionResult _EditInformation(Customer customer) { if (Session["CustomerEmail"] == null) return RedirectToAction("AccessDenied"); if(new DACustomer().updateCustomer((string)Session["CustomerEmail"], customer)) Session["CustomerEmail"] = customer.email; return RedirectToAction("Index"); }
public Order(int ID, Customer customer, List<OrderLine> lines, DateTime orderTime, DateTime sentTime) { this.ID = ID; this.customer = customer; this.lines = lines; this.orderTime = orderTime; this.sentTime = sentTime; calculateTotalPrice(); }
public Order(ShoppingCart cart, Customer customer) { this.ID = 0; this.customer = customer; lines = cart.items.Select(item => new OrderLine(){ ID = 0, item = item.item, quantity = item.quantity }).ToList(); this.orderTime = DateTime.Now; this.sentTime = null; this.totalPrice = cart.totalPrice; }