public ActionResult Edit(string id, CountryUpdateModel model) { var country = CountriesService.GetCountryByCountryCode(id); if (ModelState.IsValid) { try { country.CountryCode = model.CountryCode; country.CountryName = model.CountryName; country.CountryOrder = model.CountryOrder; country.Displayable = model.Displayable ? "1" : "0"; country = CountriesService.Update(country); //Todo: Flash Update return RedirectToAction("Index"); } catch (ErrorException errorException) { errorException.ToModelState(this); return View(model); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return View(model); } } return RedirectToAction("Index"); }
public ActionResult Edit(string id) { var country = CountriesService.GetCountryByCountryCode(id); if (country != null) { var model = new CountryUpdateModel(country); return View(model); } return RedirectToAction("Index"); }