public ActionResult Delete(int id = 0) { if (!LoginUserSession.Current.IsAdministrator) { return(Edit()); } CityRepository repo = new CityRepository(); if (repo.GetByID(id) != null) { City city = repo.GetByID(id); repo.DeleteByID(city.ID); TempData["Message"] = "Successfully deleted city!"; } else { TempData["ErrorMessage"] = "No such city!"; } return(RedirectToAction("Edit")); }