Exemple #1
0
        public async Task <ActionResult <IEnumerable <Product> > > GetAllProduct()

        {
            return(await _efCoreRepositoryProduct.GetAll());

            // return await _efCoreRepositoryProduct.GetAllProduct();
        }
 public IActionResult Get()
 {
     return(Ok(_repository.GetAll().Select(p => new ProductViewModel {
         Id = p.Id,
         Name = p.Name,
         Description = p.Description,
         Price = p.Price
     })));
 }
        /// <summary>
        /// GET /products
        /// GET /products/vendors/{vendorGuid}
        /// </summary>
        public object Get(Products request)
        {
            //return new ProductsResponse
            //{
            //    Products = String.IsNullOrEmpty(request.Vendor)
            //        ? Global.StaticMovieCatalog.GetAll()
            //        : Global.StaticMovieCatalog.GetByVendor(request.Vendor)
            //};

            return(new ProductsResponse
            {
                Products = ProductRepository.GetAll().Select(x => x.ToProduct()).ToList()
            });
        }
 public List <Product> FilterProductsByCategoryID(int categoryID)
 {
     return(Repository.GetAll().Where(p => p.CategoryID == categoryID)
            .ToList());
 }