Exemple #1
0
        public static List <Productcategorie> All()
        {
            ProductcategorieSQLContext psc = new ProductcategorieSQLContext();
            ProductCategorieRepository pr  = new ProductCategorieRepository(psc);

            return(pr.RetrieveAll());
        }
Exemple #2
0
        public static Productcategorie Find(string key)
        {
            ProductcategorieSQLContext psc = new ProductcategorieSQLContext();
            ProductCategorieRepository pr  = new ProductCategorieRepository(psc);

            return(pr.Retrieve(key));
        }
        public void Delete()
        {
            ProductcategorieSQLContext psc = new ProductcategorieSQLContext();
            ProductCategorieRepository pr  = new ProductCategorieRepository(psc);

            pr.Delete("4");
        }
        public void RetrieveAll()
        {
            ProductcategorieSQLContext psc = new ProductcategorieSQLContext();
            ProductCategorieRepository pr  = new ProductCategorieRepository(psc);

            List <Productcategorie> lijst = pr.RetrieveAll();

            Assert.IsTrue(lijst[0].Hoofdcategorie == null);
            Assert.IsTrue(lijst[1].Hoofdcategorie.Id == 1);
        }
        public void Create()
        {
            ProductcategorieSQLContext psc = new ProductcategorieSQLContext();
            ProductCategorieRepository pr  = new ProductCategorieRepository(psc);

            Productcategorie p = pr.Retrieve("1");

            //  p.Hoofdcategorie = pr.Retrieve("1");
            pr.Create(p);
        }
        public void Update()
        {
            ProductcategorieSQLContext psc = new ProductcategorieSQLContext();
            ProductCategorieRepository pr  = new ProductCategorieRepository(psc);

            Productcategorie p = pr.Retrieve("1");

            p.Omschrijving = "testaangepast";

            pr.Update(p);
        }
Exemple #7
0
        public void SaveOrUpdate()
        {
            ProductcategorieSQLContext psc = new ProductcategorieSQLContext();
            ProductCategorieRepository pr  = new ProductCategorieRepository(psc);

            if (Id != 0)
            {
                pr.Update(this);
            }
            else
            {
                pr.Create(this);
            }
        }
        public void Retrieve()
        {
            ProductcategorieSQLContext psc = new ProductcategorieSQLContext();
            ProductCategorieRepository pr  = new ProductCategorieRepository(psc);

            Productcategorie pc = pr.Retrieve("2");

            Assert.IsTrue(pc.Id == 2);
            Assert.IsTrue(pc.Hoofdcategorie.Id == 1);

            pc = pr.Retrieve("1");

            Assert.IsTrue(pc.Id == 1);
            Assert.IsTrue(pc.Hoofdcategorie == null);
        }
Exemple #9
0
 public UnitOfWork(HuahuiDbContext context)
 {
     _context          = context;
     Carts             = new CartRepository(_context);
     CartItemLists     = new CartItemListRepository(_context);
     Customers         = new CustomerRepository(_context);
     Orders            = new OrderRepository(_context);
     OrderItemLists    = new OrderItemListRepository(_context);
     Products          = new ProductRepository(_context);
     ProductCategories = new ProductCategorieRepository(_context);
     ProductGroups     = new ProductGroupRepository(_context);
     Sales             = new SaleRepository(_context);
     UnitOfProducts    = new UnitOfProductRepository(_context);
     Users             = new UserRepository(_context);
 }