//SOLID //Open Closed Principle static void Main(string[] args) { //Data Transformation Object //ProductTest(); //CategoryTest(); IProductService productManager = new ProductManager(new EfProductDal(), new CategoryManager(new EfCategoryDal())); Product product2 = new Product { CategoryId = 1, ProductId = 7, ProductName = "Opel", UnitPrice = 100, UnitsInStock = 5 }; productManager.Add(product2); }
private static void ProductTest() { IProductService productService = new ProductManager(new EfProductDal(), new CategoryManager(new EfCategoryDal())); //ProductManager productManager = new ProductManager(new EfProductDal()); productService.Add(new Product { CategoryId = 1, ProductName = "sfagfdfs", UnitPrice = 12, UnitsInStock = 13 }); var result = productService.GetProductDetails(); if (result.Success) { foreach (var product in result.Data) { Console.WriteLine(product.ProductName + "---" + product.CategoryName); } } else { Console.WriteLine(result.Message); } }