Database Reference
In-Depth Information
public UserService(IGraphClient graphClient)
{
_graphClient = graphClient;
}
public GraphStory login(GraphStory graphStory)
{
tempuser = getByUserName (graphStory.user.username.ToLower());
if (tempuser!=null)
{
// set the graphStory.user to the tempuser var
graphStory.user = tempuser;
}
// or if not found, then return error.
else{
graphStory.haserror = true;
graphStory.error = "The username you entered does not exist.";
}
return graphStory;
}
public User getByUserName (string username)
{
User u = null;
Node<User> n = _graphClient.Cypher
.Match(" (user:User {username:{user}} ) ")
.WithParam("user", username.ToLower())
.Return(user => user.As<Node<User>>())
.Results.Single();
// set user
u = n.Data;
// set node id
u.noderef = n.Reference;
return u;
}
}
Updating a User
To access the page for updating a user, click on the “User Settings” link in the social graph section, as shown in
Figure 7-4 . In this example, the front-end code uses an AJAX request via PUT and inserts—or, in the case of the
ajordan user, updates—the first and last name.
 
Search WWH ::




Custom Search