Beispiel #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());
        }