public ViewResult Details(int?id)
        {
            logger.LogTrace("Trace Log");
            logger.LogDebug("Debug Log");
            logger.LogInformation("Information Log");
            logger.LogWarning("Warning Log");
            logger.LogError("Error Log");
            logger.LogCritical("Critical Log");

            Upload upload = _uploadRepository.GetUpload(id.Value);

            if (upload == null)
            {
                Response.StatusCode = 404;
                return(View("UploadNotFound", id.Value));
            }

            HomeDetailsViewModel homeDetailsViewModel = new HomeDetailsViewModel()
            {
                Upload    = upload,
                PageTitle = "Upload Details"
            };

            return(View(homeDetailsViewModel));
        }
        public IActionResult DeleteProductUpload(int productId, int uploadId)
        {
            try
            {
                var upload = _uploadRepository.GetUpload(uploadId);
                upload.IsDeleted = true;
                _uploadRepository.EditUpload(upload);
                _uploadRepository.SaveChanges();

                var path = System.IO.Path.Combine(_env.WebRootPath, "uploads", "products", productId.ToString(), upload.FileName);
                System.IO.File.Delete(path);

                return(Ok(true));
            }
            catch (Exception)
            {
                return(Ok(false));
            }
        }
        public IActionResult OnGetDeleteImage(int uploadId)
        {
            try
            {
                var upload = _uploadRepository.GetUpload(uploadId);
                upload.IsDeleted          = true;
                upload.LasUpdatedByUserId = _userManager.GetUserId(User);
                upload.LastUpdatedOnDate  = DateTime.Now;
                _uploadRepository.EditUpload(upload);
                _uploadRepository.SaveChanges();

                var filePath = System.IO.Path.Combine(_env.WebRootPath, "uploads", "carousels", upload.FileName);
                System.IO.File.Delete(filePath);
                return(new JsonResult(true));
            }
            catch (Exception ex)
            {
                return(new JsonResult(false));
            }
        }
 public async Task <ActionResult> GetUpload(int id)
 {
     return(Ok(await _uploadRepository.GetUpload(id)));
 }