Exemplo n.º 1
0
 public ProductsController()
 {
     db = new ETradeContext();
     productRepository  = new Repository <Product>(db);
     categoryRepository = new Repository <Category>(db);
     productService     = new ProductService(productRepository);
     categoryService    = new CategoryService(categoryRepository);
 }
Exemplo n.º 2
0
 public void Delete(Product product)
 {
     using (ETradeContext context = new ETradeContext())
     {
         var entity = context.Entry(product);
         entity.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
Exemplo n.º 3
0
 public ProductRepository(ETradeContext eTradeContext)
 {
     _eTradeContext = eTradeContext;
 }
Exemplo n.º 4
0
 public CategoryRepository(ETradeContext eTradeContext)
 {
     _eTradeContext = eTradeContext;
 }
Exemplo n.º 5
0
 public CategoriesController()
 {
     db = new ETradeContext();
     categoryRepository = new Repository <Category>(db);
     categoryService    = new CategoryService(categoryRepository);
 }