Exemplo n.º 1
0
        public async Task <ActionResult <TimeTableWithCourseNameOutputModel> > GetTimeTableConflicts([FromBody] TimeTableWithWeekDaysInputModel model)
        {
            if (model == null)
            {
                return(BadRequest("Model is empty"));
            }
            List <TimeTable> newTimeTable = TimeTableWithWeekDaysMapper.ToDataModels(model);
            List <TimeTable> result       = await lessonStorage.GetTimeTableConflicts(newTimeTable);

            if (result.Count != 0)
            {
                return(Ok(TimeTableWithCourseNameMapper.ToOutputModels(result)));
            }

            foreach (var timetable in newTimeTable)
            {
                await lessonStorage.AddOrUpdateTimeTable(timetable);
            }
            return(Ok());
        }
Exemplo n.º 2
0
 public async Task <List <TimeTableWithCourseNameOutputModel> > GetTimetableForStudent(int teacherId)
 {
     return(TimeTableWithCourseNameMapper.ToOutputModels(await lessonStorage.GetTeacherTimetable(teacherId)));
 }
Exemplo n.º 3
0
        public async Task <ActionResult <List <TimeTableWithCourseNameOutputModel> > > GetTeacherTimetable(int userId)
        {
            List <TimeTable> timeTables = await lessonStorage.GetTeacherTimetable(userId);

            return(Ok(TimeTableWithCourseNameMapper.ToOutputModels(timeTables)));
        }