/// <summary> /// Deprecated Method for adding a new object to the Friends EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToFriends(Friend friend) { base.AddObject("Friends", friend); }
/// <summary> /// Create a new Friend object. /// </summary> /// <param name="firstAccountID">Initial value of the FirstAccountID property.</param> /// <param name="secondAccountID">Initial value of the SecondAccountID property.</param> /// <param name="isFriend">Initial value of the IsFriend property.</param> public static Friend CreateFriend(global::System.Int32 firstAccountID, global::System.Int32 secondAccountID, global::System.Boolean isFriend) { Friend friend = new Friend(); friend.FirstAccountID = firstAccountID; friend.SecondAccountID = secondAccountID; friend.IsFriend = isFriend; return friend; }
public void SendFriendshipRequest(int currentAccountID, int friendAccountID) { Friend friendshipRecord = GetFriendshipRecord(currentAccountID, friendAccountID); if (friendshipRecord == null) { friendshipRecord = new Friend { FirstAccountID = currentAccountID, SecondAccountID = friendAccountID, IsFriend = false }; _db.AddToFriends(friendshipRecord); _db.SaveChanges(); _notifyService.SendMessage( GetEmailByAccountID(friendAccountID), "You have new friend request", _messageGenerator.MessageSendFriendshipRequest( GetFirstLastNameByAccountID(currentAccountID), ConfigurationManager.AppSettings.Get("base_application_url") + "Friends/" + friendAccountID.ToString())); } }