public ActionResult TownCityGridPartialAddNew(NorthOps.Ops.Models.AddressTownCity item) { var model = new object[0]; if (ModelState.IsValid) { try { // Insert here a code to insert the new item in your model } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } return(PartialView("_TownCityGridPartial", model)); }
public ActionResult TownCityGridPartialUpdate(NorthOps.Ops.Models.AddressTownCity item) { var model = new object[0]; if (ModelState.IsValid) { try { unitOfWork.TownCityRepo.Update(item); unitOfWork.Save(); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } return(PartialView("_TownCityGridPartial", unitOfWork.TownCityRepo.Get(includeProperties: "AddressStateProvince"))); }