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