public SignUpPersonLesson AddStudentOnLesson(AddPersonOnLessonDTO addPersonOnLesson) { var sub = SubjectService.Get(SubjectService.GetAll().FirstOrDefault(x => x.Name == addPersonOnLesson.Subject).Id); var record = new SignUpPersonLesson() { Person = PersonService.Get(PersonService.GetAll() .FirstOrDefault(x => x.FirstName == addPersonOnLesson.FirstName && x.LastName == addPersonOnLesson.LastName).Id), Lesson = LessonService.Get(LessonService.GetAll() .FirstOrDefault(x => x.Cabinet == addPersonOnLesson.Cabinet && x.Subject == sub).Id) }; Create(record); return(record); }
public IActionResult recordPersonLesson([FromBody] AddPersonOnLessonDTO request) => Ok(SignUpPersonLessonService.AddStudentOnLesson(request));