public KatalogRepository( MyShopContext db ) { _db = db; }
public TypeProductRepository ( MyShopContext db ) { _db = db; }
private void DatabaseSeed() { using (MyShopContext db = new MyShopContext()) { db.Categories.Add(new Category() { CategoryName = "Electronics" }); db.Products.Add(new Product() { ProductName = "SimpleProduct" }); db.SaveChanges(); } }
public ProductItemRepository(MyShopContext db) { _db = db; }
public MyShopDataSeeder(IWebHostEnvironment env, IDbContextFactory <MyShopContext> ctx) { _env = env; _ctx = ctx.CreateDbContext(); }
public List <ProductType> GetProductTypes([ScopedService] MyShopContext myShopContext) { return(myShopContext.ProductTypes.ToList()); }
public List <Shop> GetShops([ScopedService] MyShopContext myShopContext) { return(myShopContext.Shops.ToList()); }
public Shop GetShop(Guid id, [ScopedService] MyShopContext myShopContext) { return(myShopContext.Shops.FirstOrDefault(x => x.Id == id)); }