public async Task <ActionResult <Trainer> > GetById(int id) { var result = await _trainersService.GetById(id); if (result == null) { return(NotFound()); } return(Ok(result)); }
public async Task <ActionResult> GetById(Guid id) { if (!ModelState.IsValid) { return(BadRequest(ModelState.GetErrorMessages())); } var result = await _trainerService.GetById(id); if (!result.Success) { return(BadRequest(result.Message)); } var trainerResource = _mapper.Map <Trainer, TrainerResource>(result.Trainer); return(Ok(trainerResource)); }