internal bool TryAddNewUser(tblUser user) { try { using (var conn = new BetweenUsEntities()) { conn.tblUsers.Add(user); conn.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
internal bool AddNewFriend(int user1id, int user2id) { try { using (var conn = new BetweenUsEntities()) { conn.tblFriends.Add(new tblFriend() { UserID = user1id, UserID2 = user2id }); conn.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
internal bool RemoveFriendRequest(int friendRequestID) { try { using (var conn = new BetweenUsEntities()) { var requestToRemove = conn.tblFriendRequests .FirstOrDefault(x => x.FriendRequestID == friendRequestID); if (requestToRemove != null) { conn.tblFriendRequests.Remove(requestToRemove); conn.SaveChanges(); return(true); } return(false); } } catch (Exception) { return(false); } }