Beispiel #1
0
        public IActionResult CheckOut(decimal discountPercent)
        {
            if (_shoppingCart.GetTotalCountItems() == 0)
            {
                ModelState.AddModelError("", "Your cart is empty, add some items Coffee first");
            }
            if (ModelState.IsValid)
            {
                var     totalbill        = _shoppingCart.GetShoppingCartTotal();
                decimal discountedbill   = _payment.GetDiscountedPrince(discountPercent, _shoppingCart.GetShoppingCartTotal());
                var     paymentViewModel = new PaymentViewModel()
                {
                    DiscountedAmount  = discountedbill,
                    discountedPercent = discountPercent,
                    payview           = true,
                    TotalAmount       = totalbill,
                };
                return(View(paymentViewModel));
            }

            return(PartialView("_Empty"));
        }