Beispiel #1
0
 public UsersService(SignInManager <User> signInManager,
                     UserManager <User> userManager,
                     QuasarDbContext context,
                     IMapper mapper)
 {
     this.signInManager = signInManager;
     this.userManager   = userManager;
     this.context       = context;
     this.mapper        = mapper;
 }
        private void SeedUsers(UserManager <User> userManager, QuasarDbContext context)
        {
            if (userManager.FindByNameAsync("admin").Result == null)
            {
                var address = new Address();

                context.Add(address);
                context.SaveChanges();

                User user = new User
                {
                    UserName = "******",
                    Address  = address
                };

                IdentityResult result = userManager.CreateAsync
                                            (user, "123456").Result;

                if (result.Succeeded)
                {
                    userManager.AddToRoleAsync(user, "Admin").Wait();
                }
            }
        }
 public ProductsService(QuasarDbContext context, IMapper mapper)
 {
     this.context    = context;
     this.mapper     = mapper;
     this.cloudinary = this.ConfigureCloudAccount();
 }
Beispiel #4
0
 public OrdersService(QuasarDbContext context, UserManager <User> userManager, IMapper mapper)
 {
     this.context     = context;
     this.userManager = userManager;
     this.mapper      = mapper;
 }