Beispiel #1
0
        private static void ProductTest()
        {
            ProductManager productmanager = new ProductManager(new EfProductDal(), new CategoryManager(new EfCategoryDal()));

            foreach (var p in productmanager.GetAll().Data)
            {
                Console.WriteLine(p.ProductName);
            }

            productmanager.GetAllByCagetoryId(2);
            productmanager.GetAllByUnitPrice(20, 35);

            var result = productmanager.GetProductDetails();

            if (result.Success == true)
            {
                foreach (var product in result.Data)
                {
                    Console.WriteLine(product.ProductName + "/" + product.CategoryName);
                }
            }
            else
            {
                Console.WriteLine(result.Message);
            }
        }
Beispiel #2
0
        private static void Subat3()
        {
            ProductManager productManager = new ProductManager(new EfProductDal());

            foreach (var product2 in productManager.GetAllByCategoryId(1).Data)
            {
                Console.WriteLine(product2.ProductName);
            }
            foreach (var product2 in productManager.GetAllByUnitPrice(5, 10).Data)
            {
                Console.WriteLine(product2.ProductName);
            }
            Product product = productManager.Get(new Product()
            {
                ProductName = "Sirop d'érable"
            }).Data;

            Console.WriteLine(product.ProductId + " - " + product.CategoryId + " - " + product.ProductName + " - " + product.UnitPrice);
            Product product3 = new Product()
            {
                CategoryId = 2, ProductName = "test", UnitPrice = 333, UnitsInStock = 5
            };

            //productManager.Add(product3);
            Console.WriteLine(productManager.Get(product3).Data.ProductId);
            //productManager.Delete(productManager.Get(product3));
        }
Beispiel #3
0
        private static void ProductTest()
        {
            ProductManager productManager = new ProductManager(new EfProductDal());

            foreach (var product in productManager.GetAllByUnitPrice(50, 100))
            {
                Console.WriteLine(product.ProductName);
            }
        }
Beispiel #4
0
        private static void ProductTestByUnitPrice()
        {
            //ProductManager productManager = new ProductManager(new InMemoryProductDAL());
            ProductManager productManager = new ProductManager(new EfProductDAL(), new CategoryManager(new EfCategoryDAL()));

            var result = productManager.GetProductDetails();

            if (result.Success)
            {
                foreach (var item in productManager.GetAllByUnitPrice(50, 100).Data)
                {
                    Console.WriteLine(item.ProductName);
                }
            }
            else
            {
                Console.WriteLine(result.Message);
            }
        }