コード例 #1
0
ファイル: ExamsController.cs プロジェクト: x17127271/AskMeAPI
        public async Task <IActionResult> CreateExam([FromBody] ExamQuestionsForCreationDto model)
        {
            // maps resource to domain model
            var exam = _mapper.Map <Exam>(model);

            try
            {
                // create lesson
                var isCreated = await _examService.AddExamQuestions(exam, model.questions);

                return(Ok(isCreated));
            }
            catch (Exception ex)
            {
                // return error message if there was an exception
                return(BadRequest(new { message = ex.Message }));
            }
        }