예제 #1
0
        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));
        }
예제 #2
0
 public async Task <IActionResult> AddStudentAsync(Student student)
 {
     _logger.Information("Insertion Started");
     return(await _studentsService.AddStudentAsync(student));
 }