public async Task <IActionResult> GetSchoolStudents([FromRoute] Guid schoolId) { var school = await _studentService.GetSchool(schoolId); if (school == null) { return(NotFound()); } var students = await _studentService.GetSchoolStudents(schoolId); return(Ok(StudentDto.Map(students))); }
public async Task <IActionResult> CreateStudent([FromRoute] Guid schoolId, [FromBody] CreateStudentRequest request) { var school = await _studentService.GetSchool(schoolId); if (school == null) { return(NotFound()); } var student = new Student { Id = Guid.NewGuid(), Name = request.Name, SchoolId = schoolId, CreatedTime = _dateTimeService.UtcNow }; await _studentService.CreateStudent(student); return(Ok(StudentDto.Map(student))); }