Пример #1
0
 public List <Category> GetCategories()
 {
     using (var context = new NorthwindSlimEntities())
     {
         var categories = context.Categories.OrderBy(a => a.CategoryId).ToList();
         return(categories);
     }
 }
Пример #2
0
 public List <Product> GetProductsByCategory(int categoryId)
 {
     using (var context = new NorthwindSlimEntities())
     {
         var products = context.Products.Where(a => a.CategoryId == categoryId).OrderBy(a => a.ProductName).ToList();
         return(products);
     }
 }