public List <OrderDetails> GetOrderDetailsByProductId(int id) { var db = new NorthwindContext(); return(db.OrderDetails.Where(x => x.ProductId == id).Include(x => x.Product).Include(x => x.Order).ToList <OrderDetails>()); }
public List <dynamic> GetOrders() { var db = new NorthwindContext(); return(db.Orders.Select(x => new { x.Id, x.Date, x.Required, x.ShipName, x.ShipCity }).ToList <dynamic>()); }
public List <Product> GetProductByCategory(int id) { var db = new NorthwindContext(); return(db.Products.Include(x => x.Category).Where(x => x.Category.Id == id).ToList <Product>()); }
//Category public List <Category> GetCategories() { var db = new NorthwindContext(); return(db.Categories.ToList <Category>()); }
public List <Product> GetProductByName(string s) { var db = new NorthwindContext(); return(db.Products.Include(x => x.Category).Where(x => x.Name.ToLower().Contains(s.ToLower())).ToList <Product>()); }