public List <Category> Categories() { using (var context = new NorthwindSlimEntities()) { var categories = context.Categories.OrderBy(a => a.CategoryId).ToList(); return(categories); } }
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); } }