public DataResult RemoveFriend(User user, User friend) { user.Friends.Remove(friend); return new DataResult(); }
public List<User> GetFollowedBy(User user) { return DataContext.Users.Where(p => p.Friends.Any(f => f.Id == user.Id)).ToList(); }
public DataResult ChangePassword(User user, string password) { user.Password = HashHelpers.GetSHA256Hash(password,user.Salt.ToString()); return new DataResult(Main.ChangePAsswordMessage); }
public DataResult AddUser(User user) { DataContext.Users.Add(user); return new DataResult(Main.AddedUser); }
public DataResult AddFriend(User user, User friend) { user.Friends.Add(friend); return new DataResult(); }
public DataResult UpdateProfile(User oldUser, User newUser) { oldUser.Email = newUser.Email; oldUser.FirstName = newUser.FirstName; oldUser.LastName = newUser.LastName; oldUser.CurrentLocation = newUser.CurrentLocation; oldUser.Weight = newUser.Weight; oldUser.Height = newUser.Height; oldUser.FavouriteSport = newUser.FavouriteSport; oldUser.IsPublicProfile = newUser.IsPublicProfile; oldUser.BirthDate = newUser.BirthDate; oldUser.WorkoutPrivacy = newUser.WorkoutPrivacy; return new DataResult(Main.UpdateProfileMessage); }