public Response <UserModel> GetById(int id) { var response = new Response <UserModel>(); try { var user = _userModelDomain.GetById(id); var userList = _mapper.Map <UserModel>(user); response.Data = userList; if (response.Data != null) { response.IsSuccess = true; response.Message = "Consulta Exitosa!!!"; } else { response.IsSuccess = true; response.Message = "No existe el registro"; } } catch (Exception e) { response.Message = e.Message + "--> InnerException.Message-->" + (e.InnerException != null ? e.InnerException.Message : ""); _logger.LogError(response.Message); } return(response); }
public async Task <IHttpActionResult> GetById(int id) { try { return(Ok(await userDomain.GetById(id))); } catch (UserIdNotFoundException e) { return(Content(HttpStatusCode.BadRequest, e.Message)); } }
public User Get(Guid id) { return(_domain.GetById(id)); }