示例#1
0
        public static void Initialize(IApplicationBuilder app)
        {
            context = app.ApplicationServices.GetRequiredService <WebStoreContext>();

            context.Database.EnsureCreated();


            if (context.Categories.Any())
            {
                return; // Az adatbázist már inicializáltnak vesszük, ha létezik kategoria
            }

            SeedCategories();
            SeedProducts();
        }
示例#2
0
        public static void Initialize(WebStoreContext _context, UserManager <Customer> userManager,
                                      RoleManager <IdentityRole <int> > roleManager)
        {
            context      = _context;
            _userManager = userManager;
            _roleManager = roleManager;

            context.Database.EnsureCreated();


            if (context.Categories.Any())
            {
                return; // Az adatbázist már inicializáltnak vesszük, ha létezik kategoria
            }

            SeedCategories();
            SeedProducts();
            SeedUsers();
        }
示例#3
0
 public SpecimenRepository(WebStoreContext ctx)
 {
     context = ctx;
 }
示例#4
0
 public OrderRepository(WebStoreContext ctx)
 {
     context = ctx;
 }
示例#5
0
 public StoreService(ShoppingCartService shoppingCartService, WebStoreContext context, UserManager <Customer> userManager)
 {
     this.shoppingCartService = shoppingCartService;
     this.context             = context;
     this.userManager         = userManager;
 }
 public ShoppingCartService(WebStoreContext context, IHttpContextAccessor httpContext)
 {
     this.context      = context;
     this.httpContext  = httpContext.HttpContext;
     ShoppingCartItems = new List <ShoppingCartItem>();
 }
示例#7
0
 public ComponentRepository(WebStoreContext ctx)
 {
     context = ctx;
 }