public void Create(Evaluation evaluation)
        {
            _evaluationRepository.Add(evaluation);

            foreach (var question in evaluation.Questions)
            {
                if (question.Id == 0)
                {
                    _questionRepository.Add(question);
                }

                EvaluationQuestion eq = new EvaluationQuestion()
                {
                    EvaluationId = evaluation.Id,
                    QuestionId   = question.Id
                };

                _evaluationQuestionRepository.Add(eq);
            }

            _evaluationRepository.Commit();
        }
        /// <summary>
        /// Add
        /// </summary>
        /// <param name="eval"></param>
        /// <returns></returns>
        public string Add(EvaluateUser eval)
        {
            try
            {
                string validate = Validate(eval);

                if (validate == "")
                {
                    Evaluation evaluation = new Evaluation();
                    evaluation.Date       = DateTime.Now;
                    evaluation.OrderedId  = eval.OrderedId;
                    evaluation.Score      = eval.Score;
                    evaluation.UserIdFrom = eval.UserIdFrom;
                    evaluation.UserIdTo   = eval.UserIdTo;
                    _evaluationRepository.Add(evaluation);
                }

                return(validate);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Example #3
0
        // Pre test Question

        #region Evaluation
        public int AddEvaluation(DLModel.Evaluation evaluation)
        {
            return(_evaluationRepository.Add(evaluation).EvaluationID);
        }