public async Task <IActionResult> CreateExam([FromBody] CreatingExamModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } // Todo: need to check all fields before entering a new one. // Todo: Exams with the same date, but with different rooms, are two separate exams var exam = examService.FindByTime(model.Date); if (exam.Result == null) { var examId = await examService.CreateNew(model); return(StatusCode(StatusCodes.Status201Created, examId)); } return(Conflict()); }