public async Task <Result> HandleAsync(AddExamCommand command)
        {
            var exam = new Exam(Guid.NewGuid(), command.Name, command.Type, command.Category, _user.Identity.Name, DateTime.Now, false);

            foreach (var q in command.Questions)
            {
                exam.AddQuestion(q.Order, q.Text, q.A, q.B, q.C, q.D, q.CorrectAnswer, q.Explanation);
            }

            await _examsRepository.AddAsync(exam);

            return(Result.Success());
        }
Ejemplo n.º 2
0
        public async Task <Exam> CreateAsync(Exam entity)
        {
            await _examsRepository.AddAsync(entity);

            return(entity);
        }