Esempio n. 1
0
        public async Task <OperationResult <Unit> > AddUserAnswers(int testId, SendTestAnswersDto dto)
        {
            int userId = userContext.UserId;
            List <UserAnswer> answers = dto.Answers
                                        .Select(x => testMapper.MapToUserAnswer(x, testId, userId))
                                        .ToList();

            if (answers.Count == 0)
            {
                return(new BadRequestError());
            }

            return(await testService.AddUserAnswers(testId, answers));
        }