示例#1
0
        public ActionResult Pay()
        {
            var administrationMethods = new AdministrationMethods();

            var responseOrder = administrationMethods.InsertOrder(new Order()
            {
                Transaction = Transaction.GetTransaction()
                , CardType  = (UtilsMethdos.PayMethod.GetType() == 2 ? UtilsMethdos.PayMethod.GetCardClient().Type : 0)
                , Discount  = Utils.GetDiscountCode()
                , Processor = (UtilsMethdos.PayMethod.GetType() != 2 ?
                               (
                                   UtilsMethdos.PayMethod.GetType() == 1 ? 7 : 3
                               ) : 2)
                , Status = 2
            }).Result;

            Console.WriteLine($"Resultado del registro del pedido: {responseOrder}");

            foreach (var item in Shopping.ShowPurchases())
            {
                var responseShopping = administrationMethods.InsertShoppingCart(new ShoppingCart()
                {
                    Transaction    = Transaction.GetTransaction()
                    , ProductPrice = item.ProductPrice
                    , Quantity     = item.Quantity
                    , Name         = string.Empty
                    , Price        = decimal.Zero
                }).Result;
                Console.WriteLine($"Carrito de producto: {item.Name}, ¿Realizado con exito? {responseShopping}");
            }

            var responseClient = administrationMethods.InsertClient(ClientUtils.GetClient()).Result;

            Console.WriteLine($"Registro del cliente: {responseClient}");
            return(RedirectToAction("CancelOrder", "Home"));
        }