Пример #1
0
 public ActionResult EditRequest(ValidationRequest requestModel, HttpPostedFileBase[] documents)
 {
     try
     {
         if (User.IsInRole("Student"))
         {
             requestModel.DateFilled = DateTime.Now;
             if (ModelState.IsValid)
             {
                 if (documents.First() != null)
                 {
                     if (FileVerification.AreFilesPDF(documents))
                     {
                         studentActions.UpdateStudentRequest(requestModel);
                         AddRequestFilesToResource(requestModel, documents);
                         return(RedirectToAction("RequestStatus"));
                     }
                     else
                     {
                         TempData["ErrorMessage"] = "Please upload pdf files only. Please try again.";
                         return(RedirectToAction("EditRequest", new { scholarshipID = requestModel.ScholarshipID }));
                     }
                 }
                 else
                 {
                     studentActions.UpdateStudentRequest(requestModel);
                     return(RedirectToAction("RequestStatus"));
                 }
             }
             else
             {
                 ViewBag.errorMessage = "Invalid inputs. Please try again.";
             }
             return(View(requestModel));
         }
         else
         {
             TempData["errorMessage"] = "Sorry you do not have access.";
             return(RedirectToAction("Announcement", "WebsiteContent"));
         }
     }
     catch (Exception e)
     {
         TempData["errorMessage"] = "There was an error in updating your request. Please try again, thank you!" + e.ToString();
         return(RedirectToAction("RequestStatus"));
     }
 }