Exemplo n.º 1
0
        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>());
        }
Exemplo n.º 2
0
        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>());
        }
Exemplo n.º 3
0
        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>());
        }
Exemplo n.º 4
0
        //Category
        public List <Category> GetCategories()
        {
            var db = new NorthwindContext();

            return(db.Categories.ToList <Category>());
        }
Exemplo n.º 5
0
        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>());
        }