Open the Program.cs
file and import the following namespaces:
using static System.Console; using Packt.CS7; using Microsoft.EntityFrameworkCore; using System.Linq;
In the Main
method, add the following statements to:
Create an instance of the
Northwind
class that will manage the databaseCreate a query for all categories that includes their related products
Enumerates through the categories, outputting the name and number of products for each one
Prompt the user for a price for products
Create a query for products that cost more than the price by using LINQ
Loop through the results
using(var db = new Northwind()) { WriteLine("List of categories and the number of products:"); IQueryable<Category> cats = db.Categories.Include(c => c.Products); foreach(Category c in cats) { WriteLine( $"{c.CategoryName} has...