Beispiel #1
0
        [HttpPost("lesson-topic")] // api/lesson/lesson-topic
        public async Task <ActionResult <int> > AddLessonTopic([FromBody] LessonTopicInputModel inputModel)
        {
            LessonTopic lessonTopic = LessonTopicMapper.ToDataModel(inputModel);

            if (lessonTopic == null)
            {
                return(BadRequest("Model is empty"));
            }
            return(Ok(await lessonStorage.AddLessonTopic(lessonTopic)));
        }
Beispiel #2
0
        public static LessonTopic ToDataModel(LessonTopicInputModel inputModel)
        {
            var result = new LessonTopic
            {
                Id             = inputModel.Id,
                LessonId       = inputModel.LessonId,
                ThemeDetailsId = inputModel.ThemeDetailsId
            };

            return(result);
        }