Пример #1
0
        public IHttpActionResult PostUserEvaluation(UserEvaluation userEvaluation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            //Checks if a evaluation for the e-mail entered already exists
            if (UserEvaluationExists(userEvaluation.DS_EMAIL))
            {
                return(Conflict());
            }
            else
            {
                //Creates a new id
                userEvaluation.CD_USEREVALUATION = Guid.NewGuid();

                db.UserEvaluation.Add(userEvaluation);

                try
                {
                    db.SaveChanges();

                    //Check scores and send e-mail
                    UserEvaluationBLL.CheckApplicantScores(userEvaluation);
                }
                catch (DbUpdateException)
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = userEvaluation.CD_USEREVALUATION }, userEvaluation));
        }
        public void CheckApplicantScores()
        {
            UserEvaluation userEval = new UserEvaluation()
            {
                DS_EMAIL = "*****@*****.**", DS_NAME = "Tiago Seminotti", NR_EVAL_HTML = 5, NR_EVAL_CSS = 4, NR_EVAL_JAVASCRIPT = 3, NR_EVAL_PYTHON = 6, NR_EVAL_DJANGO = 5, NR_EVAL_IOS = 8, NR_EVAL_ANDROID = 2
            };

            UserEvaluationBLL.CheckApplicantScores(userEval);
        }