Пример #1
0
 public UnitOfWork(ApplicationDbContext db)
 {
     _db      = db;
     Category = new CategoryRepository(_db);
     SP_Call  = new SP_Call(_db);
 }
Пример #2
0
 public CategoryController()
 {
     _context = new CategoryRepository();
 }
Пример #3
0
        public void Products()
        {
            var conn = new NHibernateConnection();
            var productRepo = new ProductsRepository(conn);
            var categoryRepo = new CategoryRepository(conn);
            var manufacturersRepository = new ManufacturersRepository(conn);
            Categories category = categoryRepo.Get(4);

            Manufacturers manufacturer = manufacturersRepository.Get(1);

            var product = new Products("Towar", "Jego opis", Convert.ToDecimal(125.99), category, manufacturer, 100,
                false, true, false, "Krótki opis");

            productRepo.Save(product);

            Products fromDB = productRepo.Get(product.ID);

            Assert.AreEqual(product, fromDB);
        }
Пример #4
0
 public UnitOfWork(ApplicationDbContext c)
 {
     this.context = c;
     Category     = new CategoryRepository(this.context);
     CoverType    = new CoverTypeRepository(this.context);
 }