示例#1
0
        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);
        }
示例#2
0
 public async Task <IHttpActionResult> GetById(int id)
 {
     try
     {
         return(Ok(await userDomain.GetById(id)));
     } catch (UserIdNotFoundException e)
     {
         return(Content(HttpStatusCode.BadRequest, e.Message));
     }
 }
示例#3
0
 public User Get(Guid id)
 {
     return(_domain.GetById(id));
 }