public ActionResult DeleteLog(int id, string fileName, DateTime?date) { var file = SysUpdateHelper.GetSystemLogFile(id, date ?? DateTime.Now, fileName); if (file != null && file.Exists) { file.Delete(); } return(RedirectToAction(nameof(Log), new { id, date })); }
public ActionResult DownloadLog(int id, string fileName, DateTime?date) { var system = SysUpdateHelper.GetSystem(id); if (system == null) { return(NotFound()); } var file = SysUpdateHelper.GetSystemLogFile(id, date ?? DateTime.Now, fileName); if (file == null) { return(NotFound()); } return(File(file.FullName, "text/plain", file.Name)); }
public ActionResult LogContent(int id, string fileName, DateTime?date) { var system = SysUpdateHelper.GetSystem(id); if (system == null) { return(NotFound()); } var file = SysUpdateHelper.GetSystemLogFile(id, date ?? DateTime.Now, fileName); if (file == null) { return(NotFound()); } using (var reader = file.OpenText()) { ViewBag.LogContent = reader.ReadToEnd(); return(View()); } }