public ActionResult Delete(string id) { var country = CountriesService.GetCountryByCountryCode(id); if (country != null) { var model = new CountryDeleteModel(country); return View(model); } return RedirectToAction("Index"); }
public ActionResult Delete(string id, CountryDeleteModel model) { try { var country = CountriesService.GetCountryByCountryCode(id); CountriesService.Delete(country); this.FlashInfo(string.Format("Country {0} was deleted successfully!", country.CountryName)); return RedirectToAction("Index"); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return View(model); } }