public bool Delete(PreLaunchNotyUser preLaunchUser)
 {
     using (var context = new CPL.Data.Infrastructure.CplContext())
     {
         context.Entry(preLaunchUser).State = EntityState.Deleted;
         context.SaveChanges();
         return(true);
     }
 }
 public PreLaunchNotyUser Update(PreLaunchNotyUser preLaunchUser)
 {
     using (var context = new CPL.Data.Infrastructure.CplContext())
     {
         context.Entry(preLaunchUser).State = EntityState.Modified;
         context.SaveChanges();
         return(preLaunchUser);
     }
 }
 public PreLaunchNotyUser Create(PreLaunchNotyUser preLaunchUser)
 {
     using (var context = new CPL.Data.Infrastructure.CplContext())
     {
         context.PreLaunchNotyUsers.Add(preLaunchUser);
         context.SaveChanges();
         return(preLaunchUser);
     }
 }
Ejemplo n.º 4
0
        private void _createUser(UserModel user, PreLaunchNotyUser preLaunchAppUser, string appUserIdentityId)
        {
            preLaunchAppUser.AppIdentityUserId  = appUserIdentityId;
            preLaunchAppUser.UserName           = user.UserName;
            preLaunchAppUser.EmailAddress       = user.EmailAddress;
            preLaunchAppUser.MobilePhone        = user.MobilePhone;
            preLaunchAppUser.EmailNotifications = user.EmailNotyEnabled;
            preLaunchAppUser.SmsNotifications   = user.SmsNotyEnabled;
            preLaunchAppUser.CreatedDate        = DateTime.UtcNow;

            _preLaunchUserRepository.Create(preLaunchAppUser);
        }
        public IdentityResult RegisterUserSync(UserModel userModel, PreLaunchNotyUser appUser)
        {
            //TODO: Add Roles or Claims: http://stackoverflow.com/questions/19541101/add-role-in-asp-net-identity
            //http://stackoverflow.com/questions/28335353/how-to-extend-available-properties-of-user-identity
            var user = new ApplicationUser();

            user.UserName          = userModel.UserName;
            user.PreLaunchUserId   = appUser.AppUserId;
            user.EmailNotyEnabled  = appUser.EmailNotifications;
            user.MobileNotyEnabled = appUser.SmsNotifications;
            user.PhoneNumber       = appUser.MobilePhone;
            user.Email             = appUser.EmailAddress;
            var result = _userManager.Create(user, userModel.Password);

            return(result);
        }