public ActionResult Delete(Feedback feedback) { feedbackService.DeleteByPrimaryKey(feedback.ID); if (!string.IsNullOrEmpty(feedback.ImageUrl)) { string fileName = Server.MapPath(feedback.ImageUrl); if (System.IO.File.Exists(fileName)) { FileInfo fileInfo = new FileInfo(fileName); Directory.Delete(fileInfo.Directory.FullName, true); } } return(RedirectToAction("Index")); }