/// <summary> /// Uses linq to find the first 5 products in the NorthWind class /// </summary> /// <param name="northWind">A NorthWind class</param> public static void First5Products(INorthWind northWind) { Console.WriteLine(""); Console.WriteLine("First 5 products"); //Write list with name of first 5 products northWind.Products().Take(5).ToList().ForEach(x => WriteLineLock(x.ProductName)); }
/// <summary> /// Uses linq to find the "Counting of orders by shipping country. Output by descending count" in the NorthWind class /// </summary> /// <param name="northWind">A NorthWind class</param> public static void OrdersByShippingCountry(INorthWind northWind) { Console.WriteLine(""); Console.WriteLine("Counting of orders by shipping country. Output by descending count"); //Write the counting of orders by shipping country. Order the output by descending count [use LINQ] Dictionary<string, int> countryCount = new Dictionary<string, int>(); northWind.Orders().ToList().GroupBy(x => x.ShipCountry).Select(x => x.First()).ToList() .ForEach(x => countryCount.Add(x.ShipCountry, northWind.Orders().Select(a => a.ShipCountry).Where(c => c == x.ShipCountry).Count())); countryCount.Keys.ToList().OrderBy(x => countryCount[x]).ToList().ForEach(x => WriteLineLock(x + " : " + countryCount[x])); }
/// <summary> /// Default constructor /// </summary> /// <param name="northWind">NorthWind instance</param> /// <param name="order">Inherited order</param> public OrdersByTotalPriceDto(INorthWind northWind, Orders order) { this.northWind = northWind; this.order = order; }
public ReportingModule(INorthWind northWind) { this.northWind = northWind; }
public OrdersModelView(INorthWind northWind) { this.northWind = northWind; modelChangeEvent += modelChanged; }