Exemple #1
0
        public HttpResponseMessage GetUserById(int userId)
        {
            User        user  = new User();
            List <User> users = LogicUser.GetUserById(userId);

            if (users.Count > 0)
            {
                user = users[0];
                return(new HttpResponseMessage(HttpStatusCode.OK)
                {
                    Content = new ObjectContent <User>(user, new JsonMediaTypeFormatter())
                });
            }
            return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "error"));
        }