コード例 #1
0
 public IHttpActionResult GetUser(string id)
 {
     try
     {
         userValidator.secure(Request);
         User    user    = userValidator.GetUser(id);
         UserDTO userDTO = new UserDTO()
         {
             UserId  = user.UserId,
             Name    = user.Name,
             Admin   = user.Admin,
             Deleted = user.Deleted,
             Phone   = user.Phone
         };
         return(Ok(userDTO));
     }
     catch (NotExistException exception)
     {
         return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.BadRequest, exception.Mymessage)));
     }
     catch (System.Data.SqlClient.SqlException)
     {
         return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "VecinosUY no se puede conectar a la base de datos (∩︵∩)")));
     }
     catch (Exception exception) {
         return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exception.Message)));
     }
 }