public DefaultUser(UserManager <AppUser> userManager,
                    RoleManager <IdentityRole> roleManager,
                    BaselDbContext baselDbContext)
 {
     _userManager = userManager;
     _roleManager = roleManager;
 }
        public async Task SetDefaultUser(IServiceScope serviceScope, BaselDbContext _baselDb)
        {
            if (!_baselDb.Users.Any())
            {
                using (var RoleManager = serviceScope.ServiceProvider.GetRequiredService <RoleManager <IdentityRole> >())
                {
                    using (var UserManager = serviceScope.ServiceProvider.GetRequiredService <UserManager <AppUser> >())
                    {
                        bool IsHasRole = await RoleManager.RoleExistsAsync("Admin");

                        if (!IsHasRole)
                        {
                            IdentityRole.Name = "Admin";

                            await RoleManager.CreateAsync(IdentityRole);

                            AppUser appUser = new AppUser()
                            {
                                UserName = "******",
                                Email    = "*****@*****.**"
                            };

                            await UserManager
                            .CreateAsync(appUser, "Nicat12345@");

                            await UserManager.AddToRoleAsync(appUser, "Admin");
                        }
                    }
                }
            }
        }
Пример #3
0
 public AccountController(BaselDbContext baselDb,
                          SignInManager <AppUser> signInManager,
                          UserManager <AppUser> userManager)
 {
     _baselDb       = baselDb;
     _signInManager = signInManager;
     _userManager   = userManager;
 }
 public HomeController(BaselDbContext baselDb,
                       SignInManager <AppUser> signInManager,
                       UserManager <AppUser> userManager,
                       IHostingEnvironment hostingEnvironment)
 {
     _baselDb            = baselDb;
     _signInManager      = signInManager;
     _userManager        = userManager;
     _hostingEnvironment = hostingEnvironment;
 }
 public ConnectHomeViewComponent(BaselDbContext baselDbContext)
 {
     _baselDbContext = baselDbContext;
 }
Пример #6
0
 public ColorController(BaselDbContext baselDb)
 {
     _baselDb = baselDb;
 }
Пример #7
0
 public HomeSocialAccountViewComponent(BaselDbContext baselDbContext)
 {
     _baselDbContext = baselDbContext;
 }
Пример #8
0
 public HeadMenuViewComponent(BaselDbContext baselDbContext)
 {
     _baselDbContext = baselDbContext;
 }
 public UserViewComponent(BaselDbContext baselDbContext,
                          UserManager <AppUser> roleManager)
 {
     _baselDbContext = baselDbContext;
     _userManager    = roleManager;
 }
Пример #10
0
 public LatestNewsViewComponent(BaselDbContext baselDbContext)
 {
     _baselDbContext = baselDbContext;
 }
Пример #11
0
 public ShopMenuViewComponent(BaselDbContext baselDbContext)
 {
     _baselDbContext = baselDbContext;
 }
Пример #12
0
 public CartController(BaselDbContext baselDb,
                       UserManager <AppUser> userManager)
 {
     _baselDb     = baselDb;
     _userManager = userManager;
 }
Пример #13
0
 public AdminDashboardViewComponent(BaselDbContext baselDbContext)
 {
     _baselDbContext = baselDbContext;
 }
Пример #14
0
 public ProductController(BaselDbContext baselDb)
 {
     _baselDb = baselDb;
 }
Пример #15
0
 public CategoryController(BaselDbContext baselDb)
 {
     _baselDb = baselDb;
 }
Пример #16
0
 public HomeController(BaselDbContext baselDb)
 {
     _baselDb = baselDb;
 }
 public FeatureCategoryViewComponent(BaselDbContext baselDbContext)
 {
     _baselDbContext = baselDbContext;
 }
 public UserStore(BaselDbContext context)
 {
     Context = context;
 }
 public AccountMenuViewComponent(BaselDbContext baselDbContext)
 {
     _baselDbContext = baselDbContext;
 }
 public MenuNavViewComponent(BaselDbContext baselDbContext)
 {
     _baselDbContext = baselDbContext;
 }
 public RelateProductViewComponent(BaselDbContext baselDbContext)
 {
     _baselDbContext = baselDbContext;
 }
 public ProductOptionViewComponent(BaselDbContext baselDbContext)
 {
     _baselDbContext = baselDbContext;
 }
Пример #23
0
 public PageAboutViewComponent(BaselDbContext baselDbContext)
 {
     _baselDbContext = baselDbContext;
 }
 public SlideController(BaselDbContext baselDb)
 {
     _baselDb = baselDb;
 }
 public SlideViewComponent(BaselDbContext baselDbContext)
 {
     _baselDbContext = baselDbContext;
 }
 public BaselLogoViewComponent(BaselDbContext baselDbContext)
 {
     _baselDbContext = baselDbContext;
 }
Пример #27
0
 public ProductCategoryViewComponent(BaselDbContext baselDbContext)
 {
     _baselDbContext = baselDbContext;
 }
 public FooterMenuViewComponent(BaselDbContext baselDbContext)
 {
     _baselDbContext = baselDbContext;
 }