public async Task <IActionResult> CreateStudent(Guid classId, [FromBody] UpsertStudentDto studentDto) { if (studentDto == null) { return(BadRequest()); } if (!ModelState.IsValid) { return(StatusCode(StatusCodes.Status422UnprocessableEntity)); } var id = await _studentsService.AddStudentAsync(classId, studentDto); return(Ok(id)); }
public async Task <IActionResult> AddStudentAsync(Student student) { _logger.Information("Insertion Started"); return(await _studentsService.AddStudentAsync(student)); }