Esempio n. 1
0
        public ActionResult ValidateScholarship(int?scholarshipID)
        {
            try
            {
                if (User.IsInRole("Student"))
                {
                    if (scholarshipID == null)
                    {
                        return(RedirectToAction("StudentScholarship"));
                    }
                    else
                    {
                        bool isScholarshipSiblingDiscount = studentActions.GetScholarshipByID((int)scholarshipID).ScholarshipName.ToLower() == "sibling discount" ? true:false;
                        ViewBag.isScholarshipSiblingDiscount = isScholarshipSiblingDiscount;

                        bool isStudentPassedApplicationForm = studentActions.IsStudentPassedApplicationForm((int)scholarshipID, User.Identity.GetUserId());
                        ViewBag.isStudentPassedApplicationForm = isStudentPassedApplicationForm;

                        return(View(new ValidationRequest()
                        {
                            ScholarshipID = (int)scholarshipID,
                            DateFilled = DateTime.Now,
                            UserID = User.Identity.GetUserId(),
                            StatusID = 1, //1 == approved
                            PeriodID = WebSettings.CurrentPeriod().PeriodID,
                            Processed = false,
                            Remarks = " "
                        }));
                    }
                }
                else
                {
                    TempData["errorMessage"] = "Sorry you do not have access.";
                    return(RedirectToAction("Announcement", "WebsiteContent"));
                }
            }
            catch (Exception e)
            {
                TempData["errorMessage"] = "There was an error. Please try again, thank you!" + e.ToString();
                return(RedirectToAction("StudentScholarship"));
            }
        }