Exemplo n.º 1
0
        public Entities.Product GetProduct(int pid)
        {
            List <Entities.Product> prods = new List <Entities.Product>();

            foreach (Entities.Product p in _context.Products)
            {
                prods.Add(p);
            }
            Entities.Product produ = (from p in prods
                                      where p.Id == pid
                                      select p).FirstOrDefault();
            return(produ);
        }
Exemplo n.º 2
0
        public Models.Products GetProductsFromInventory(Entities.Inventory inv)
        {
            List <Entities.Product> products = new List <Entities.Product>();

            foreach (Entities.Product r in _context.Products)
            {
                products.Add(r);
            }
            Entities.Product prod = (from p in products
                                     where p.Id == inv.ProductId
                                     select p).First();
            return(new Models.Products(prod.Price, prod.Description));
        }