Esempio n. 1
0
        public Sals PostNistDataQuestions([FromBody] NistQuestionsAnswers updateValue)
        {
            int            assessmentId = Auth.AssessmentForUser();
            NistSalManager nistSal      = new NistSalManager();

            return(nistSal.SaveNistQuestions(assessmentId, updateValue));
        }
Esempio n. 2
0
 public Sals SaveNistQuestions(int assessmentid, NistQuestionsAnswers answer)
 {
     using (CSET_Context db = new CSET_Context())
     {
         var dbAnswer = db.NIST_SAL_QUESTION_ANSWERS.Where(x => x.Assessment_Id == assessmentid && x.Question_Id == answer.Question_Id).FirstOrDefault();
         if (dbAnswer == null)
         {
             throw new ApplicationException(String.Format("Question {0} could not be found for assessment {1}!", answer.Question_Number, assessmentid));
         }
         TinyMapper.Map <NistQuestionsAnswers, NIST_SAL_QUESTION_ANSWERS>(answer, dbAnswer);
         db.SaveChanges();
         return(CalculateOveralls(assessmentid, db));
     }
 }