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

            PrintProductInformation(AlphabetProducts);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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");
 }
Exemplo n.º 11
0
        /// <summary>
        /// Print the products alphabetically by name
        /// </summary>
        static void Exercise16()
        {
            var alphabet = DataLoader.LoadProducts().OrderBy(a => a.ProductName);

            PrintProductInformation(alphabet);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 14
0
        /// <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);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Print the products alphabetically by name
        /// </summary>
        static void Exercise16()
        {
            var ByName = DataLoader.LoadProducts().OrderBy(x => x.ProductName);

            PrintProductInformation(ByName);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 29
0
        /// <summary>
        /// Sample, load and print all the customer objects and their orders
        /// </summary>
        static void PrintAllCustomers()
        {
            var customers = DataLoader.LoadCustomers();

            PrintCustomerInformation(customers);
        }
Exemplo n.º 30
0
        /// <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);
        }