示例#1
0
        // Submit App
        public async Task OnPostSubmitAppl()
        {
            SFAppVM = await _app.BuildSFAppVM(User.Identity.Name);

            SFApp appl = await _app.GetSFAppAsync(User.Identity.Name);

            appl.AppStatus = AppStatus.Submitted;
            appl           = await _app.UpdateSFAppAsync(appl);

            if (appl.AppStatus == AppStatus.Submitted)
            {
                // build email
                Email message = new Email()
                {
                    Recipient = User.Identity.Name,
                    ConfigSet = "",
                    Subject   = "Your Silton Foundation grant application has been received!",
                    BodyHtml  = @"<html>
                                <head></head>
                                <body>
                                  <h1>Thank you for applying!</h1>
                                </body>
                                </html>",
                };
                bool emailStatus = await message.Send();
            }
            else
            {
                ModelState.AddModelError(string.Empty, "Submit failed. Please try again.");
            }
            //await _eval.CreateEvaluationsForAppAsync(appl.ID);
        }
示例#2
0
        // Save Applicant app response updates
        public async Task OnPostUpdateAppResponses(SFAppViewModel sFApp)
        {
            foreach (AppResponse item in sFApp.AppResponses)
            {
                await _response.UpdateAppResponseAsync(item);
            }
            SFAppVM = await _app.BuildSFAppVM(User.Identity.Name);

            ViewApp = true;
        }
示例#3
0
        public async Task OnGetStartApplication()
        {
            // get logged in user's info
            AppUser user = await _user.FindByEmailAsync(User.Identity.Name);

            // if user is not 'Applicant', add Applicant role
            if (!await _user.IsInRoleAsync(user, AppRoles.Applicant))
            {
                await _user.AddToRoleAsync(user, AppRoles.Applicant);
            }

            // create new application
            SFApp newApp = await _app.CreateSFAppAsync(user.Email);

            SFAppVM = await _app.BuildSFAppVM(User.Identity.Name);
        }
示例#4
0
        /// <summary>
        /// Builds a new SFAppViewModel object from the SFApp associated with user who owns 'email'
        /// </summary>
        /// <param name="email"> email of user whose app to prepare as SFAppViewModel </param>
        /// <returns> SFAppViewModel for user's current SFApp, or 'null' if no open SFApp exists </returns>
        public async Task <SFAppViewModel> BuildSFAppVM(string email)
        {
            SFApp appl = await GetSFAppAsync(email);

            if (appl != null)
            {
                SFAppViewModel sFApp = new SFAppViewModel();
                sFApp.Appl         = appl;
                sFApp.AppResponses = await _response.GetAllAppResponsesAsync(appl.ID);

                sFApp.Questions = await _question.GetAppQuestionsAsync(sFApp.AppResponses);

                sFApp.Categories = _question.GetAllCategories(sFApp.Questions);
                return(sFApp);
            }
            return(null);
        }
示例#5
0
        public async Task OnGetReadySubmit()
        {
            SFAppVM = await _app.BuildSFAppVM(User.Identity.Name);

            PromptSubmit = true;
        }
示例#6
0
        // To view an application for a selected applicant
        public async Task OnGetViewAppl()
        {
            SFAppVM = await _app.BuildSFAppVM(User.Identity.Name);

            ViewApp = true;
        }
示例#7
0
 public async Task OnGet()
 {
     SFAppVM = await _app.BuildSFAppVM(User.Identity.Name);
 }