private void AddUserProfile(User user) { using (var dc = new LessThanDatabase()) { var userProfileLogin = dc.UserProfileLogins.FirstOrDefault(a => a.UniqueIdentifier == user.ClaimedIdentifier); if (userProfileLogin == null) { var userProfile = new UserProfile { EmailAddress = user.EmailAddress, FullName = user.Name, UserName = user.EmailAddress }; dc.UserProfiles.AddObject(userProfile); userProfileLogin = new UserProfileLogin { UniqueIdentifier = user.ClaimedIdentifier, UserProfile = userProfile }; dc.UserProfileLogins.AddObject(userProfileLogin); dc.SaveChanges(); } } }
/// <summary> /// Create a new UserProfile object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="userName">Initial value of the UserName property.</param> /// <param name="fullName">Initial value of the FullName property.</param> /// <param name="emailAddress">Initial value of the EmailAddress property.</param> public static UserProfile CreateUserProfile(global::System.Int32 id, global::System.String userName, global::System.String fullName, global::System.String emailAddress) { UserProfile userProfile = new UserProfile(); userProfile.Id = id; userProfile.UserName = userName; userProfile.FullName = fullName; userProfile.EmailAddress = emailAddress; return userProfile; }
/// <summary> /// Deprecated Method for adding a new object to the UserProfiles EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToUserProfiles(UserProfile userProfile) { base.AddObject("UserProfiles", userProfile); }