public async Task <IActionResult> PostOneAsync([FromBody] PostActivationDto activationDto) { if (!ModelState.IsValid) { return(BadRequest(ModelState.Values)); } var postedActivation = await _activationsService.CreateOneAsync(activationDto.ToActivation()); if (postedActivation == null) { return(BadRequest()); } return(StatusCode(201, postedActivation)); }
public async Task <IActionResult> PostActivationToExercise(string exerciseId, [FromBody] PostActivationDto activationDto) { if (!ModelState.IsValid) { return(BadRequest(ModelState.Values)); } var postedActivation = await _exercisesService.CreateActivation(exerciseId, activationDto.ToActivation()); if (postedActivation == null) { return(NotFound()); } return(StatusCode(201, postedActivation)); }