Skip to content

Instantly share code, notes, and snippets.

@aramkoukia
Created August 5, 2017 22:12
Show Gist options
  • Select an option

  • Save aramkoukia/ccc745e6e1c916bfb73914a5747c4b2a to your computer and use it in GitHub Desktop.

Select an option

Save aramkoukia/ccc745e6e1c916bfb73914a5747c4b2a to your computer and use it in GitHub Desktop.
public class EFRepository
{
public List<Product> GetAllProductsByCategory(int categoryId)
{
using (var db = new EFCore2TestContext())
{
var products = db.Product
.Where(b => b.ProductCategoryId == categoryId)
.OrderBy(b => b.ProductNumber)
.Include(p => p.ProductCategory)
.ToList();
return products;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment