public ActionResult Delete(int id, StateDeleteModel model) { try { var state = StatesService.GetStateByStateId(id); StatesService.Delete(state); this.FlashInfo(string.Format("State {0} was deleted successfully!", state.StateName)); return RedirectToAction("Index"); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return View(model); } }
public ActionResult Delete(int id) { var state = StatesService.GetStateByStateId(id); if (state != null) { var model = new StateDeleteModel(state); return View(model); } return RedirectToAction("Index"); }