/// <summary>
        /// Checks the applicant scores and sends e-mails
        /// </summary>
        /// <param name="pApplicant">Applicant data</param>
        public static void CheckApplicantScores(Models.UserEvaluation pApplicant)
        {
            //An applicant is approved for a front end opening when HTML, CSS and JavaScript are between the approved scores
            bool frontEndMail = IsApprovedScore(pApplicant.NR_EVAL_HTML) && IsApprovedScore(pApplicant.NR_EVAL_CSS) && IsApprovedScore(pApplicant.NR_EVAL_JAVASCRIPT) ? true : false;
            //An applicant is approved for a back end opening when Python and Django are between the approved scores
            bool backEndMail = IsApprovedScore(pApplicant.NR_EVAL_PYTHON) && IsApprovedScore(pApplicant.NR_EVAL_DJANGO) ? true : false;
            //An applicant is approved for a back end opening when iOS and Android are between the approved scores
            bool mobileEmail = IsApprovedScore(pApplicant.NR_EVAL_IOS) && IsApprovedScore(pApplicant.NR_EVAL_ANDROID) ? true : false;

            SendEmail(frontEndMail, backEndMail, mobileEmail, pApplicant.DS_EMAIL).Wait();
        }
Esempio n. 2
0
        public async Task <ActionResult> Create(Models.UserEvaluation pUserEvaluation)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            try
            {
                using (var client = new HttpClient())
                {
                    //Uses API URL
                    client.BaseAddress = new Uri(_serviceURL);
                    client.DefaultRequestHeaders.Clear();

                    HttpResponseMessage responseMessage = await client.PostAsJsonAsync("api/UserEvaluations", pUserEvaluation);

                    //Checks for success
                    if (responseMessage.IsSuccessStatusCode)
                    {
                        //Returns to the listing view
                        ViewBag.message = "Applicant evaluation registered.";
                        return(View());
                    }
                    else
                    {
                        ModelState.AddModelError(string.Empty, string.Format("Error: {0}", responseMessage.ReasonPhrase));
                        return(View());
                    }
                }
            }
            catch
            {
                return(View());
            }
        }