コード例 #1
0
 public List <Category> Categories()
 {
     using (var context = new NorthwindSlimEntities())
     {
         var categories = context.Categories.OrderBy(a => a.CategoryId).ToList();
         return(categories);
     }
 }
コード例 #2
0
 public List <Product> GatProductByCategoriesId(int categoryId)
 {
     using (var context = new NorthwindSlimEntities())
     {
         var products = (from p in context.Products
                         where p.CategoryId == categoryId
                         orderby p.ProductName
                         select p).ToList();
         return(products);
     }
 }