public IActionResult Index() { ViewBag.Email = HttpContext.Session.GetString("Email"); ViewBag.Password = HttpContext.Session.GetString("Password"); ViewBag.AuthUser = _userDAO.RetrieveUserType(ViewBag.Email); if (ViewBag.Email != null) { ViewBag.DisplayName = _userDAO.RetrieveUserDisplay(ViewBag.Email); } if (string.IsNullOrWhiteSpace(_hostingEnvironment.WebRootPath)) { _hostingEnvironment.WebRootPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot"); } string webRoot = _hostingEnvironment.WebRootPath; var file = new HistoryServices(); string filePath = webRoot + @"\Images\Gallery\2003"; var _service = new HistoryServices(); ViewBag.fileCount2003Folder = _service.CountFiles(webRoot + @"\Images\Gallery\2003"); ViewBag.fileName = file.FileName(filePath); return(View("Gallery2003CarShow")); }
// GET: /<controller>/ public IActionResult Index() { ViewBag.Email = HttpContext.Session.GetString("Email"); ViewBag.Password = HttpContext.Session.GetString("Password"); ViewBag.AuthUser = _userDAO.RetrieveUserType(ViewBag.Email); if (string.IsNullOrWhiteSpace(_hostingEnvironment.WebRootPath)) { _hostingEnvironment.WebRootPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot"); } string webRoot = _hostingEnvironment.WebRootPath; if (ViewBag.Email != null) { ViewBag.DisplayName = _userDAO.RetrieveUserDisplay(ViewBag.Email); } var _service = new HistoryServices(); ViewBag.fileCount2002Folder = _service.CountFiles(webRoot + @"\Images\Gallery\2002"); ViewBag.file2002ModifiedDate = _service.LastDateModified(webRoot + @"\Images\Gallery\2002"); ViewBag.fileCount2003Folder = _service.CountFiles(webRoot + @"\Images\Gallery\2003"); ViewBag.file2003ModifiedDate = _service.LastDateModified(webRoot + @"\Images\Gallery\2003"); ViewBag.fileCount2004Folder = _service.CountFiles(webRoot + @"\Images\Gallery\2004"); ViewBag.file2004ModifiedDate = _service.LastDateModified(webRoot + @"\Images\Gallery\2004"); ViewBag.fileCount2005Folder = _service.CountFiles(webRoot + @"\Images\Gallery\2005"); ViewBag.file2005ModifiedDate = _service.LastDateModified(webRoot + @"\Images\Gallery\2005"); ViewBag.fileCount2006Folder = _service.CountFiles(webRoot + @"\Images\Gallery\2006"); ViewBag.file2006ModifiedDate = _service.LastDateModified(webRoot + @"\Images\Gallery\2006"); //ViewBag.fileCount2007Folder = _service.CountFiles(@"Images\Gallery\2007"); //ViewBag.file2007ModifiedDate = _service.LastDateModified(@"Images\Gallery\2007"); return(View("History")); }