public ActionResult Edit(CustomerModel editedCustomer) { if (this.ModelState.IsValid) { var entity = this.UpdateEntity(editedCustomer); return this.RedirectToAction("Details", new { entity.Id }); } return this.View(editedCustomer); }
public ActionResult Delete(CustomerModel entity) { this.DeleteEntity(entity); return this.RedirectToAction("Index"); }
private void DeleteEntity(CustomerModel entity) { this.entityService.Delete(entity.Id); }
private Customer UpdateEntity(CustomerModel editedEntity) { var entity = Mapper.Map<Customer>(editedEntity); this.entityService.Update(entity); return entity; }
public ActionResult New(CustomerModel newCustomer) { if (this.ModelState.IsValid) { var entity = Mapper.Map<Customer>(newCustomer); this.entityService.Add(entity); return this.RedirectToAction("Index"); } return this.View(newCustomer); }