public IActionResult Edit(EditCountyModel model) { if (ModelState.IsValid) { countyService.Update(model.Id, model.Name); return(RedirectToAction(nameof(Index))); } return(View(model)); }
public ActionResult EditCounty(EditCountyModel model) { if (ModelState.IsValid) { var updatedCounty = new County() { Name = model.Name, ShortName = model.ShortName, IdCounty = model.CountyId }; Services.LocalitiesService.UpdateCounty(updatedCounty); } return(RedirectToAction("EditCounty", new { id = model.CountyId })); }
public ActionResult EditCounty(int id) { var county = Services.LocalitiesService.GetCounty(id); if (county == null) { return(HttpNotFound()); } var model = new EditCountyModel() { CountyId = county.IdCounty, Name = county.Name, ShortName = county.ShortName }; return(View(model)); }