Пример #1
0
        private static void ProductTest()
        {
            ProductManager productManager = new ProductManager(new EfProductDal(), new CategoryManager(new EfCategoryDal()));

            /*foreach (var product in productManager.GetProductsDetails().Data)
             * {
             *  Console.WriteLine(product.ProductName);
             *  Console.WriteLine(product.CategoryName);
             *  Console.WriteLine("--------------------------");
             * }*/

            var result = productManager.GetAllByCategoryID(150);

            if (result.Success)
            {
                foreach (var item in result.Data)
                {
                    Console.WriteLine(item.ProductName);
                }
            }
            else
            {
                Console.WriteLine(result.Message);
            }
        }
Пример #2
0
        private static void ProductTest()
        {
            ProductManager productManager = new ProductManager(new EfProductDal(),
                                                               new CategoryManager(new EfCategoryDal()));

            Console.WriteLine("Category = 2");
            Console.WriteLine("======================================");
            foreach (var product in productManager.GetAllByCategoryID(2).Data)
            {
                Console.WriteLine(product.ProductName);
            }
            Console.WriteLine("======================================");
            Console.WriteLine("----Product And Category Name-----");
            Console.WriteLine("======================================");
            var result = productManager.GetProductDetails();

            if (result.Success)
            {
                foreach (var product in productManager.GetProductDetails().Data)
                {
                    Console.WriteLine(product.ProductName + "/" + product.CategoryName);
                }
            }
            else
            {
                Console.WriteLine(result.Message);
            }

            Console.WriteLine("======================================");
        }
Пример #3
0
        static void Main(string[] args)
        {
            ProductManager productManager = new ProductManager(new EfProductDal());

            foreach (var product in productManager.GetAllByCategoryID(2))

            {
                Console.WriteLine(product.ProductName);
            }
        }