public HttpResponseMessage Login(string userName, string password) { User user = new User(); List <User> users = LogicUser.SignIn(userName, password); if (users.Count > 0) { user = users[0]; return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new ObjectContent <User>(user, new JsonMediaTypeFormatter()) }); } return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "error")); }