public async Task <Dictionary <Product, int> > GetProductsFromCart() { var products = await PetShopDatabase.GetProductsFromCart(); Dictionary <Product, int> cartProducts = new Dictionary <Product, int>(); foreach (BasketItem b in products) { Product product = await PetShopDatabase.GetProduct(b.ProductId); cartProducts.Add(product, b.Quantity); } return(cartProducts); }
public async Task <Dictionary <Product, int> > UpdateProductsCart() { var products = await PetShopDatabase.GetProductsFromCart(); Dictionary <Product, int> productsToBasket = new Dictionary <Product, int>(); foreach (BasketItem b in products) { var prod = await PetShopDatabase.GetProduct(b.ProductId); productsToBasket.Add(prod, b.Quantity); } PropertyController.BasketListProvider.BasketProducts = productsToBasket; return(productsToBasket); }
public Task <Product> GetProduct(int id) { var product = PetShopDatabase.GetProduct(id); return(product); }