public async Task <IActionResult> AddAsync(AddExerciseBindingModel bindingModel) { var userId = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier)?.Value); var result = await _exerciseService.AddAsync(bindingModel, userId); if (result.ErrorOccurred) { return(BadRequest(result)); } return(Ok(result)); }
public async Task HandleAsync(AddExercise command) { command.Id = await _exerciseService.AddAsync(command.Name, command.PartOfBody); }