Пример #1
0
        //public static DBContext.EFUser ToEFUser(this Model.ApplicationUser user)
        //{
        //    Feedback.Data.EF.DBContext.EFUser efUser = new DBContext.EFUser()
        //    {

        //    };

        //    return efUser;
        //}

        public static Feedback.Core.Models.ApplicationUser ToAppUser(this Feedback.Data.EF.DBContext.EFUser user)
        {
            Model.ApplicationUser appUser = new Model.ApplicationUser()
            {
                Id       = user.Id,
                UserName = user.UserName
            };

            return(appUser);
        }
Пример #2
0
        //public static DBContext.EFUser ToEFUser(this Model.ApplicationUser user)
        //{
        //    Feedback.Data.EF.DBContext.EFUser efUser = new DBContext.EFUser()
        //    {
        //    };
        //    return efUser;
        //}
        public static Feedback.Core.Models.ApplicationUser ToAppUser(this Feedback.Data.EF.DBContext.EFUser user)
        {
            Model.ApplicationUser appUser = new Model.ApplicationUser()
            {
                Id = user.Id,
                UserName = user.UserName
            };

            return appUser;
        }
Пример #3
0
        public ActionResult Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser() { UserName = model.UserName };
                var result = UserService.Create(user, model.Password);
                if (result.Succeeded)
                {
                    SignIn(user, isPersistent: false);
                    return RedirectToAction("Index", "Home");
                }
                else
                {
                    AddErrors(result);
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
Пример #4
0
 private async Task SignInAsync(ApplicationUser user, bool isPersistent)
 {
     AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
     var identity = await UserService.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);
     AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, identity);
 }
Пример #5
0
        public ClaimsIdentity CreateIdentity(ApplicationUser user, string p)
        {
            var identity = userRepository.CreateIdentity(user, p);

            return identity;
        }
Пример #6
0
 public Core.Utilities.FuncResult Create(ApplicationUser user, string p)
 {
     return userRepository.Create(user, p);
 }