public ActionResult Delete(string id, ZipCodeDeleteModel model) { try { var zipCode = ZipCodesService.GetByZipCode(id); ZipCodesService.Delete(zipCode); this.FlashInfo(string.Format("Zip Code {0} was deleted successfully!", zipCode.Zip)); return RedirectToAction("Index"); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return View(model); } }
public ActionResult Delete(string id) { var zipCode = ZipCodesService.GetByZipCode(id); if (zipCode != null) { var model = new ZipCodeDeleteModel(zipCode); return View(model); } return RedirectToAction("Index"); }