public ActionResult DeleteInfo(int? id) { if (id != null) { InfoRepository InfoRepository = new InfoRepository(); Info info = InfoRepository.GetByID(id.Value); InfoRepository.Delete(info); string folderPath = "~/Content/Files/" + info.Title; if (Directory.Exists(HostingEnvironment.MapPath(folderPath))) Directory.Delete(HostingEnvironment.MapPath(folderPath), true); } return RedirectToAction("InfoPage", "Info"); }