public BasketContents Get(string basketId) { try { return(bda.Get(basketId)); } catch (Exception e) { throw new Exception($"Caught a(n) {e.GetType()} trying to load a basket."); } }
public double CalculateBasketValue(string basketId) { var value = new double(); var basket = ba.Get(basketId); foreach (Item itemInBasket in basket) { if (!itemInBasket.GetVat()) //Item is not exempt from VAT. Don't forget to add it! { var vatRate = cdb.Get(itemInBasket.ID); value = value + (itemInBasket.Price * (1 + vatRate)); continue; } value = value + itemInBasket.Price; } return(value); }