Esempio n. 1
0
        public IActionResult GetCheckout()
        {
            var checkoutItems = _checkoutService.GetCheckoutItems();
            // Instanciate a checkout object with the available checkout items and calculate the checkout total price
            var checkout = new Checkout {
                CheckoutItems = checkoutItems, TotalPrice = _checkoutService.CalculateTotal()
            };

            return(Ok(checkout));
        }
Esempio n. 2
0
 public decimal CalculateTotal(Basket basket)
 {
     return(_checkout.CalculateTotal(basket)
            - _discounts.Sum(x => x.CalculateDiscount(basket)));
 }