public ActionResult EditStaff(AddEditStaffViewModel editStaff) { if (ModelState.IsValid) { var staff = Mapper.Map <AddEditStaffViewModel, Staff>(editStaff); var updated = _staffRepository.Update(staff); if (updated) { return(RedirectToAction("Index")); } } return(View(editStaff)); }
public ActionResult AddStaff(AddEditStaffViewModel staffRequest) { if (ModelState.IsValid) { var staff = Mapper.Map <AddEditStaffViewModel, Staff>(staffRequest); var created = _staffRepository.Create(staff); if (created) { return(RedirectToAction("Index")); } } return(View(staffRequest)); }