Ejemplo n.º 1
0
    public async Task<ActionResult<WorkoutModificationDto>> UpdateAsync(
      [FromRoute] [Required] int workoutId,
      [FromBody] [Required] WorkoutModificationDto updatedWorkoutDto,
      CancellationToken cancellationToken)
    {
      var workout = await _workout.DoUpdateAsync(workoutId, updatedWorkoutDto, cancellationToken)
        .ConfigureAwait(false);

      if (workout is null) {
        return NotFound();
      }

      var workoutDto = _mapper.Map<GetWorkoutDto>(workout);
  
      return Ok(workoutDto);
    }