public ActionResult Create(Customer customer) { if (ModelState.IsValid) { Facade.GetCustomerRepository().Create(customer); return RedirectToAction("Index"); } CreateEditCustomerViewModel createEditCustomerViewModel = new CreateEditCustomerViewModel(); return View(createEditCustomerViewModel); }
public ActionResult Edit(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } else { CreateEditCustomerViewModel createEditCustomerViewModel = new CreateEditCustomerViewModel(); Customer customer = Facade.GetCustomerRepository().Read((int)id); createEditCustomerViewModel.customerId = customer.customerId; createEditCustomerViewModel.firstName = customer.firstName; createEditCustomerViewModel.lastName = customer.lastName; createEditCustomerViewModel.streetName = customer.streetName; createEditCustomerViewModel.houseNumber = customer.houseNumber; createEditCustomerViewModel.zipcode = customer.zipcode; createEditCustomerViewModel.email = customer.email; createEditCustomerViewModel.country = customer.country; createEditCustomerViewModel.confirmEmail = customer.email; return View(createEditCustomerViewModel); } }
public ActionResult Edit(MovieShopDAL.Customer customer) { if (ModelState.IsValid) { Facade.GetCustomerRepository().Update(customer); return RedirectToAction("Index"); } CreateEditCustomerViewModel createEditCustomerViewModel = new CreateEditCustomerViewModel(); createEditCustomerViewModel.firstName = customer.firstName; createEditCustomerViewModel.lastName = customer.lastName; createEditCustomerViewModel.streetName = customer.streetName; createEditCustomerViewModel.houseNumber = customer.houseNumber; createEditCustomerViewModel.zipcode = customer.zipcode; createEditCustomerViewModel.confirmEmail = customer.email; createEditCustomerViewModel.email = customer.email; createEditCustomerViewModel.country = customer.country; return View(createEditCustomerViewModel); }
public ActionResult Create() { CreateEditCustomerViewModel createEditCustomerViewModel = new CreateEditCustomerViewModel(); return View(createEditCustomerViewModel); }