public ActionResult Delete(int?id) { if (id != null) { Cinema cinema = _cinemaService.Find((int)id); _cinemaService.Delete(cinema); _cinemaService.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(long id) { CinemaDomainModel cinemaDomainModel = _cinemaService.ReadById(id); if (cinemaDomainModel == null) { return(new HttpStatusCodeResult(HttpStatusCode.NotFound)); } string physicalPath = HttpContext.Server.MapPath(cinemaDomainModel.ImagePath); System.IO.File.Delete(physicalPath); _cinemaService.Delete(cinemaDomainModel); return(RedirectToAction("Index")); }
// DELETE: api/Cinemas/5 public void Delete(int id) { _cinemaService.Delete(id); }