/// <summary> /// Print the products alphabetically by name /// </summary> static void Exercise16() { IEnumerable <Product> AlphabetProducts = DataLoader.LoadProducts().OrderBy(p => p.ProductName); PrintProductInformation(AlphabetProducts); }
/// <summary> /// Print the unique list of product categories /// </summary> static void Exercise22() { var categories = DataLoader.LoadProducts().OrderBy(p => p.Category); Console.WriteLine(categories); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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"); }
/// <summary> /// Print the products alphabetically by name /// </summary> static void Exercise16() { var alphabet = DataLoader.LoadProducts().OrderBy(a => a.ProductName); PrintProductInformation(alphabet); }
/// <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); }
/// <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); }
/// <summary> /// Print the products alphabetically by name /// </summary> static void Exercise16() { var ByName = DataLoader.LoadProducts().OrderBy(x => x.ProductName); PrintProductInformation(ByName); }
/// <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); }
/// <summary> /// Print all products that are out of stock. /// </summary> static void Exercise1() { var NotInStock = DataLoader.LoadProducts().Where(p => p.UnitsInStock == 0); PrintProductInformation(NotInStock); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }