예제 #1
0
        public async Task <IActionResult> AddAthleteAsync(
            [FromBody] AthleteForm athleteForm,
            CancellationToken ct)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(new ApiError(ModelState)));
            }

            var athleteId = await _athleteService.CreateAthleteAsync(
                athleteForm.meetId,
                athleteForm.CompNum,
                athleteForm.FirstName,
                athleteForm.LastName,
                athleteForm.TeamName,
                athleteForm.Gender,
                ct);

            return(Created(
                       Url.Link(nameof(AthletesController.GetAthleteByIdAsync),
                                new { athleteId }),
                       null));
        }