예제 #1
0
파일: User.cs 프로젝트: itai192/Taki-Online
 /// <summary>
 /// tries to decline a friend request from user with username
 /// </summary>
 public void DeclineFriendRequestFrom(string username)
 {
     if (UnopenedFriendRequests.Contains(username))
     {
         FriendsDal.ChangeStatus(username, this.username, (int)FriendRequestStatus.Declined);
     }
     else
     {
         throw new Exception("You Have No Friend Invitation From This Friend");
     }
 }
예제 #2
0
파일: User.cs 프로젝트: itai192/Taki-Online
 /// <summary>
 /// tries to send a friend request and returns a textual response
 /// </summary>
 public string AddFriend(string username)
 {
     if (DeclinedFriends.Contains(username))
     {
         FriendsDal.ChangeStatus(username, this.username, (int)FriendRequestStatus.Accepted);
         return("Your'e now friends with" + username);
     }
     else if (!FriendsDal.FriendRequestExists(username, this.username))
     {
         FriendsDal.AddFriend(this.username, username);
         return("Your friend request has been sent successfuly to " + username);
     }
     return("there already exists a friend request between you and" + username);
 }