/// <summary>
        /// Print the products alphabetically by name
        /// </summary>
        static void Exercise16()
        {
            IEnumerable <Product> AlphabetProducts = DataLoader.LoadProducts().OrderBy(p => p.ProductName);

            PrintProductInformation(AlphabetProducts);
        }
示例#2
0
        /// <summary>
        /// Print the unique list of product categories
        /// </summary>
        static void Exercise22()
        {
            var categories = DataLoader.LoadProducts().OrderBy(p => p.Category);

            Console.WriteLine(categories);
        }
示例#3
0
        /// <summary>
        /// Sample, load and print all the product objects
        /// </summary>
        static void PrintAllProducts()
        {
            List <Product> products = DataLoader.LoadProducts();

            PrintProductInformation(products);
        }
        /// <summary>
        /// Print only customers that have an order whos total is less than $500
        /// </summary>
        static void Exercise10()
        {
            var customers = DataLoader.LoadCustomers().Where(c => c.Orders.Any(o => o.Total < 500));

            PrintCustomerInformation(customers);
        }
        /// <summary>
        /// Print the products in descending order by units in stock
        /// </summary>
        static void Exercise17()
        {
            var products = DataLoader.LoadProducts().OrderByDescending(p => p.UnitsInStock);

            PrintProductInformation(products);
        }
示例#6
0
        /// <summary>
        /// Print all products that are in stock and cost more than 3.00 per unit.
        /// </summary>
        static void Exercise2()
        {
            var AvailNThree = DataLoader.LoadProducts().Where(p => p.UnitsInStock != 0 && p.UnitPrice > 3);

            PrintProductInformation(AvailNThree);
        }
        /// <summary>
        /// Print all products that are in stock and cost more than 3.00 per unit.
        /// </summary>
        static void Exercise2()
        {
            var products = DataLoader.LoadProducts().Where(p => p.UnitsInStock > 0 && p.UnitPrice > 3.00M);

            PrintProductInformation(products);
        }
示例#8
0
        /// <summary>
        /// Print the products in descending order by units in stock
        /// </summary>
        static void Exercise17()
        {
            var alphabet = DataLoader.LoadProducts().OrderByDescending(a => a.UnitsInStock);

            PrintProductInformation(alphabet);
        }
示例#9
0
        /// <summary>
        /// Print the list of products ordered first by category, then by unit price, from highest to lowest.
        /// </summary>
        static void Exercise18()
        {
            var beta = DataLoader.LoadProducts().OrderBy(a => a.Category).ThenByDescending(c => c.UnitPrice);

            PrintProductInformation(beta);
        }
示例#10
0
 /// <summary>
 /// Print all customer and their order information for the Washington (WA) region.
 /// </summary>
 static void Exercise3()
 {
     List <Customer> all = DataLoader.LoadCustomers();
     var             wa  = all.Where(units => units.Region == "WA");
 }
示例#11
0
        /// <summary>
        /// Print the products alphabetically by name
        /// </summary>
        static void Exercise16()
        {
            var alphabet = DataLoader.LoadProducts().OrderBy(a => a.ProductName);

            PrintProductInformation(alphabet);
        }
示例#12
0
        /// <summary>
        /// Print only customers that have an order whos total is less than $500
        /// </summary>
        static void Exercise10()
        {
            var order = DataLoader.LoadCustomers().Where(c => c.Orders.Any(cust => cust.Total < 500M));

            PrintCustomerInformation(order);
        }
示例#13
0
        /// <summary>
        /// Write code to check to see if Product 789 exists
        /// </summary>
        static void Exercise23()
        {
            var checkProd = DataLoader.LoadProducts().Exists(e => e.ProductID == 789);

            Console.WriteLine(checkProd);
        }
        /// <summary>
        /// Print the products in descending order by units in stock
        /// </summary>
        static void Exercise17()
        {
            IEnumerable <Product> ProductsByStock = DataLoader.LoadProducts().OrderByDescending(p => p.UnitsInStock);

            PrintProductInformation(ProductsByStock);
        }
示例#15
0
        /// <summary>
        /// Print the products alphabetically by name
        /// </summary>
        static void Exercise16()
        {
            var ByName = DataLoader.LoadProducts().OrderBy(x => x.ProductName);

            PrintProductInformation(ByName);
        }
示例#16
0
        /// <summary>
        /// Write code to check to see if Product 789 exists
        /// </summary>
        static void Exercise23()
        {
            var seveneightnine = DataLoader.LoadProducts().Any(n => n.ProductID == 789);

            Console.WriteLine(seveneightnine);
        }
示例#17
0
        /// <summary>
        /// Print all products that are out of stock.
        /// </summary>
        static void Exercise1()
        {
            var NotInStock = DataLoader.LoadProducts().Where(p => p.UnitsInStock == 0);

            PrintProductInformation(NotInStock);
        }
示例#18
0
        /// <summary>
        /// Print all products that are in stock and cost more than 3.00 per unit.
        /// </summary>
        static void Exercise2()
        {
            var inStockAndMoreThanThree = DataLoader.LoadProducts().Where(prod => (prod.UnitsInStock > 0) && (prod.UnitPrice > 3));

            PrintProductInformation(inStockAndMoreThanThree);
        }
        /// <summary>
        /// Print all products that are out of stock.
        /// </summary>
        static void Exercise1()
        {
            var products = DataLoader.LoadProducts().Where(p => p.UnitsInStock < 1);

            PrintProductInformation(products);
        }
示例#20
0
        /// <summary>
        /// Print all products that are out of stock.
        /// </summary>
        static void Exercise1()
        {
            var outOfStock = DataLoader.LoadProducts().Where(s => s.UnitsInStock == 0);

            PrintProductInformation(outOfStock);
        }
        /// <summary>
        /// Print all customer and their order information for the Washington (WA) region.
        /// </summary>
        static void Exercise3()
        {
            var customers = DataLoader.LoadCustomers().Where(c => c.Region == "WA");

            PrintCustomerInformation(customers);
        }
示例#22
0
        /// <summary>
        /// Print all products that are in stock and cost more than 3.00 per unit.
        /// </summary>
        static void Exercise2()
        {
            var inStockGreaterThan3 = DataLoader.LoadProducts().Where(s => s.UnitsInStock > 0 && s.UnitPrice > 3);

            PrintProductInformation(inStockGreaterThan3);
        }
        /// <summary>
        /// Print the products alphabetically by name
        /// </summary>
        static void Exercise16()
        {
            var products = DataLoader.LoadProducts().OrderBy(p => p.ProductName);

            PrintProductInformation(products);
        }
示例#24
0
        /// <summary>
        /// Print all customer and their order information for the Washington (WA) region.
        /// </summary>
        static void Exercise3()
        {
            var customerByRegion = DataLoader.LoadCustomers().Where(s => s.Region == "WA");

            PrintCustomerInformation(customerByRegion);
        }
        /// <summary>
        /// Print the list of products ordered first by category, then by unit price, from highest to lowest.
        /// </summary>
        static void Exercise18()
        {
            var products = DataLoader.LoadProducts().OrderBy(p => p.Category).ThenByDescending(p => p.UnitPrice);

            PrintProductInformation(products);
        }
示例#26
0
        /// <summary>
        /// Print the products in descending order by units in stock
        /// </summary>
        static void Exercise17()
        {
            var descUnitStock = DataLoader.LoadProducts().OrderByDescending(d => d.UnitsInStock);

            PrintProductInformation(descUnitStock);
        }
示例#27
0
        /// <summary>
        /// Write code to check to see if Product 789 exists
        /// </summary>
        static void Exercise23()
        {
            var results = DataLoader.LoadProducts().Any(p => p.ProductID == 789);

            Console.WriteLine(results);
        }
示例#28
0
        /// <summary>
        /// Print all customer and their order information for the Washington (WA) region.
        /// </summary>
        static void Exercise3()
        {
            var waRegion = DataLoader.LoadCustomers().Where(p => p.Region == "WA");

            PrintCustomerInformation(waRegion);
        }
示例#29
0
        /// <summary>
        /// Sample, load and print all the customer objects and their orders
        /// </summary>
        static void PrintAllCustomers()
        {
            var customers = DataLoader.LoadCustomers();

            PrintCustomerInformation(customers);
        }
        /// <summary>
        /// Print all customer and their order information for the Washington (WA) region.
        /// </summary>
        static void Exercise3()
        {
            List <Customer> customers = DataLoader.LoadCustomers().FindAll(c => c.Region == "WA");

            PrintCustomerInformation(customers);
        }