public ContentResult ToDel(int id) { SYSOpenVideo oldimgs = SYSOpenVideo.GetEntityByID(id); if (SYSOpenVideo.DeleteByID(id) > 0) { try { string delFile = Server.MapPath("~") + oldimgs.VideoUrl; System.IO.File.Delete(delFile); } catch (Exception ex) { } return(Content("ok")); } return(Content("删除出错")); }
public ContentResult imgsDel(string imgpk) { int imgID = 0; int.TryParse(imgpk, out imgID); string result = ""; SYSOpenVideo imgs = SYSOpenVideo.GetEntityByID(imgID); if (SYSOpenVideo.DeleteByID(imgID) > 0) { result = "OK"; string delFile = Server.MapPath("~") + imgs.VideoUrl; System.IO.File.Delete(delFile); } else { result = "删除失败!"; } return(Content(result)); }