public async Task <IEnumerable <ApiProduct> > GetAsync() { return((await _service.GetAllProductsAsync()).Select(c => new ApiProduct { Description = c.Description, Id = c.Id, IsAvailable = c.Availability > 0, Name = c.Name, Price = c.Price })); }
public async Task <IEnumerable <ApiProduct> > GetAsync() { IEnumerable <Product> allProducts = await _service.GetAllProductsAsync(); return(allProducts.Select(p => new ApiProduct { Id = p.Id, Description = p.Description, Price = p.Price, IsAvailable = p.Availability > 0 })); }
public async Task <IEnumerable <ApiProduct> > Get() { var products = await _catalogService.GetAllProductsAsync(); return(products.Select(x => new ApiProduct { Description = x.Description, Id = x.Id, IsAvailable = x.Availability > 0, Price = x.Price }).ToList()); }
public async Task <IEnumerable <ApiProduct> > GetAsync() { var allProduts = await _productCatalogService.GetAllProductsAsync(); return(allProduts.Select(product => new ApiProduct { Id = product.Id, Name = product.Name, Description = product.Description, Price = product.Price, IsAvailability = product.Availability > 0 })); }
public async Task <IEnumerable <ApiProduct> > GetAsync() { // return new[] { new ApiProduct { Id = Guid.NewGuid(), Description = "fake" } }; IEnumerable <Product> allProducts = await _service.GetAllProductsAsync(); return(allProducts.Select(p => new ApiProduct { Id = p.Id, Name = p.Name, Description = p.Description, Price = p.Price, IsAvailable = p.Availability })); }