public ActionResult Delete(int id) { var files = freightServices.getServerFile(id, new NewsModel().GetType().ToString()); foreach (var file in files.Where(file => file != null).Where(file => System.IO.File.Exists(Server.MapPath(file.Path)))) { System.IO.File.Delete(Server.MapPath(file.Path)); } newsServices.DeleteNew(id); return(List(string.Empty)); }