예제 #1
0
        public IActionResult EditReportIssues(ReportIssuesEditViewModel model)
        {
            if (ModelState.IsValid)
            {
                ReportIssues reportIssues = _reportIssuesRepository.GetReportIssues(model.Id);
                reportIssues.ProjectName     = model.ProjectName;
                reportIssues.Catagory        = model.Catagory;
                reportIssues.Reproducibility = model.Reproducibility;
                reportIssues.Severity        = model.Severity;
                reportIssues.Summary         = model.Summary;
                reportIssues.Description     = model.Description;
                if (model.Photo != null)
                {
                    if (model.ExistingPhotoPath != null)
                    {
                        string filePath = Path.Combine(webHostEnvironment.WebRootPath,
                                                       "images", model.ExistingPhotoPath);
                        System.IO.File.Delete(filePath);
                    }

                    reportIssues.PhotoPath = ProcessUploadedFile(model);
                }

                _reportIssuesRepository.Update(reportIssues);
                return(RedirectToAction("MainReportIssuesPage"));
            }
            return(View());
        }
예제 #2
0
 public IActionResult AddReportIssues(ReportIssuesCreateViewModel model)
 {
     if (ModelState.IsValid)
     {
         string uniqueFileName = null;
         if (model.Photo != null)
         {
             string uploadsFolder = Path.Combine(webHostEnvironment.WebRootPath, "images");
             uniqueFileName = Guid.NewGuid().ToString() + "_" + model.Photo.FileName;
             string filePath = Path.Combine(uploadsFolder, uniqueFileName);
             model.Photo.CopyTo(new FileStream(filePath, FileMode.Create));
         }
         ReportIssues newReportIssues = new ReportIssues
         {
             ProjectName     = model.ProjectName,
             Catagory        = model.Catagory,
             Severity        = model.Severity,
             Reproducibility = model.Reproducibility,
             Summary         = model.Summary,
             Description     = model.Description,
             PhotoPath       = uniqueFileName
         };
         _reportIssuesRepository.Add(newReportIssues);
         return(RedirectToAction("ReportIssuesDetails", new { id = newReportIssues.Id }));
     }
     return(View());
 }
예제 #3
0
        public ViewResult EditReportIssues(int id)
        {
            ReportIssues reportIssues = _reportIssuesRepository.GetReportIssues(id);
            ReportIssuesEditViewModel reportIssuesEditViewModel = new ReportIssuesEditViewModel
            {
                Id                = reportIssues.Id,
                ProjectName       = reportIssues.ProjectName,
                Catagory          = reportIssues.Catagory,
                Severity          = reportIssues.Severity,
                Reproducibility   = reportIssues.Reproducibility,
                Summary           = reportIssues.Summary,
                Description       = reportIssues.Description,
                ExistingPhotoPath = reportIssues.PhotoPath
            };

            return(View(reportIssuesEditViewModel));
        }
예제 #4
0
        // Report Issues Detail
        public ViewResult ReportIssuesDetails(int?id)
        {
            ReportIssues reportIssues = _reportIssuesRepository.GetReportIssues(id.Value);

            if (reportIssues == null)
            {
                Response.StatusCode = 404;
                return(View("ReportIssuesNotFound", id.Value));
            }
            HomeReportIssuesDetailsViewModel homeReportIssuesDetailsViewModel = new HomeReportIssuesDetailsViewModel()
            {
                ReportIssues = reportIssues,
                Pagetitle    = "Report Issues Details"
            };

            return(View(homeReportIssuesDetailsViewModel));
        }