Exemple #1
0
        public static LessonWithJournalAndTopicOutputModel ToOutputModel(Lesson lesson)
        {
            var result = new LessonWithJournalAndTopicOutputModel
            {
                Hometask   = lesson.Hometask,
                LessonDate = lesson.Date.ToString(@"yyyy/MM/dd"),
                LessonId   = (int)lesson.Id,
                ToRead     = lesson.ToRead,
                Videos     = lesson.Videos,
                Topics     = LessonTopicMapper.ToOutputModels(lesson.LessonTopicsDetails),
                Journals   = JournalMapper.ToOutputModels(lesson.Journals)
            };

            foreach (var journal in result.Journals)
            {
                if (journal.IsAbsent == false)
                {
                    journal.AbsentReason = null;
                }
            }
            return(result);
        }
Exemple #2
0
        public async Task <ActionResult <List <JournalOutputModel> > > JournalGetAll()
        {
            List <Journal> journals = await lessonStorage.GetAllJournal();

            return(Ok(JournalMapper.ToOutputModels(journals)));
        }