Ejemplo n.º 1
0
        public IViewComponentResult Invoke(string view = "Default")
        {
            if (view == "Small")
            {
                var totalValue = _getCart.Exec().Sum(x => x.RealValue * x.Quantity);
                return(View(view, $"${totalValue}"));
            }

            return(View(view, _getCart.Exec()));
        }
Ejemplo n.º 2
0
        public IActionResult OnGet([FromServices] GetCart getCart,
                                   [FromServices] GetCustomerInformation getCustomerInformation)
        {
            var cart = getCart.Exec();

            if (cart.Count() == 0)
            {
                return(RedirectToPage("/Cart"));
            }

            var information = getCustomerInformation.Exec();

            if (information == null)
            {
                if (_environment.IsDevelopment())
                {
                    CustomerInformation = new CustomerInformationDto
                    {
                        FirstName   = "Toko",
                        LastName    = "Goshadze",
                        Email       = "*****@*****.**",
                        PhoneNumber = "599744894",
                        Address     = "28 Amaghleba street",
                        City        = "Tbilisi",
                        PostCode    = "0105"
                    }
                }
                ;
                return(Page());
            }

            return(RedirectToPage("/Checkout/Payment"));
        }
Ejemplo n.º 3
0
        public IActionResult OnGet([FromServices] GetCustomerInformation getCustomerInformation,
                                   [FromServices] GetCart getCart)
        {
            var information = getCustomerInformation.Exec();
            var totalValue  = getCart.Exec().Sum(x => x.RealValue * x.Quantity);

            TotalValue = $"${totalValue}";

            if (information == null)
            {
                return(RedirectToPage("/Checkout/CustomerInformation"));
            }

            var cart = getCart.Exec();

            if (cart.Count() == 0)
            {
                return(RedirectToPage("/Cart"));
            }

            return(Page());
        }
Ejemplo n.º 4
0
        public IActionResult GetCartMain([FromServices] GetCart getCart)
        {
            var cart = getCart.Exec();

            return(PartialView("_CartPartial", cart));
        }
Ejemplo n.º 5
0
        public IActionResult GetCartComponent([FromServices] GetCart getCart)
        {
            var totalValue = getCart.Exec().Sum(x => x.RealValue * x.Quantity);

            return(PartialView("Components/Cart/Small", $"${totalValue}"));
        }
Ejemplo n.º 6
0
        public IActionResult OnGet([FromServices] GetCart getCart)
        {
            Cart = getCart.Exec();

            return(Page());
        }