public void Vote(string direction, int id) { var votedItem = (from votedOne in RedditContext.Reddits where votedOne.Id == id select votedOne).FirstOrDefault(); if (direction.Equals("up")) { votedItem.Score++; } else if (direction.Equals("down")) { votedItem.Score--; } RedditContext.Update(votedItem); RedditContext.SaveChanges(); }
public void UpdateUser(User user) { UserDb.Update(user); UserDb.SaveChanges(); }