public int Create(Friend obj) { var Frnd = cont.Friends.Single(e => e.UID == obj.UID && e.FrID ==obj.FrID && e.GID== obj.GID); if (Frnd != null) { return Frnd.FId; } cont.Friends.AddObject(obj); cont.SaveChanges(); return Frnd.FId; }
/// <summary> /// Create a new Friend object. /// </summary> /// <param name="fId">Initial value of the FId property.</param> public static Friend CreateFriend(global::System.Int32 fId) { Friend friend = new Friend(); friend.FId = fId; return friend; }
/// <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); }