Beispiel #1
0
        private async Task TestSelects()
        {
            List <Lesson> actualLesson = await lessonStorage.GetAllLesson();

            for (int i = 0; i < listLesson.Count; i++)
            {
                Assert.Contains(listLesson[i], actualLesson);
            }

            Lesson actual = await lessonStorage.GetLessonById((int)listLesson[0].Id);

            Assert.AreEqual(listLesson[0], actual);
        }
Beispiel #2
0
        [HttpGet("{id}")]  // api/lesson/735
        public async Task <ActionResult <LessonOutputModel> > LessonGetById(int id)
        {
            Lesson lesson = await lessonStorage.GetLessonById(id);

            if (lesson == null)
            {
                return(BadRequest($"Lesson {id} does not exist"));
            }
            return(Ok(LessonMapper.ToOutputModel(lesson)));
        }