public ActionResult Edit(RegionalOfficeView regionalOfficeModel) { if (ModelState.IsValid) { IRegionalOfficesRepository regionalOfficesRepository = new RegionalOfficesRepository(db); RegionalOffice regionalOffice = regionalOfficesRepository.GetRegionalOfficeByPK((int)regionalOfficeModel.RegionalOfficePK); regionalOfficeModel.ConvertTo(regionalOfficeModel, regionalOffice); regionalOfficesRepository.SaveChanges(); TempData["message"] = LayoutHelper.GetMessage("UPDATE", regionalOffice.RegionalOfficePK); return(RedirectToAction("Index", "RegionalOffice")); } else { return(View(regionalOfficeModel)); } }
public ActionResult Add(RegionalOfficeView regionalOfficeView) { if (ModelState.IsValid) { IRegionalOfficesRepository regionalOfficesRepository = new RegionalOfficesRepository(db); RegionalOffice regionalOffice = new RegionalOffice(); regionalOfficeView.ConvertTo(regionalOfficeView, regionalOffice); regionalOfficesRepository.Add(regionalOffice); regionalOfficesRepository.SaveChanges(); TempData["message"] = LayoutHelper.GetMessage("INSERT", regionalOffice.RegionalOfficePK); return(RedirectToAction("Index", "RegionalOffice")); } else { return(View(regionalOfficeView)); } }