Exemplo n.º 1
0
        [HttpPost("with-journals")] //api/lesson/with-journals
        public async Task <ActionResult <int?> > AddLessonWithJournals([FromBody] LessonInputModel inputModel)
        {
            if (inputModel == null)
            {
                return(BadRequest("Model is empty"));
            }

            Lesson dataModel = LessonMapper.ToDataModel(inputModel);

            if (dataModel == null)
            {
                return(BadRequest("Failed to add an object"));
            }

            return(Ok(await lessonStorage.AddJournals(dataModel)));
        }