Esempio n. 1
0
 private void AddUserProfileLogin(User user)
 {
     using (var dc = new LessThanDatabase())
     {
         var userProfileLogin = dc.UserProfileLogins.FirstOrDefault(a => a.UniqueIdentifier == user.ClaimedIdentifier);
         if (userProfileLogin == null)
         {
             userProfileLogin = new UserProfileLogin
                                    {
                                        UniqueIdentifier = user.ClaimedIdentifier,
                                        UserProfile = dc.UserProfiles.First(a => a.UserProfileLogins.Any(b=>b.UniqueIdentifier == User.Identity.Name))
                                    };
             dc.UserProfileLogins.AddObject(userProfileLogin);
             dc.SaveChanges();
         }
     }
 }
Esempio n. 2
0
 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();
         }
     }
 }