public ActionResult Create(CustomerViewModel customerViewModel) { if (!ModelState.IsValid) return View(); customersRepository.Save(Mapper.Map<CustomerViewModel, ICustomer>(customerViewModel)); return RedirectToAction("Grid", "Customers"); }
public ActionResult Details(int id) { //-- Get details of this customer ICustomer customer = customersRepository.GetByID(id); //-- Create customer view CustomerViewModel customerViewModel = new CustomerViewModel(customer); //-- Show view return View(customerViewModel); }
public ActionResult Edit(CustomerViewModel customerViewModel) { if (!ModelState.IsValid) return View(customerViewModel); customersRepository.Save(Mapper.Map<CustomerViewModel, ICustomer>(customerViewModel)); return RedirectToAction("Details", "Customers", new { id = customerViewModel.PkId }); }