Пример #1
0
        public ActionResult SaveAddress(AddressModel model)
        {
            var address = model.ToAddress();

            // address saved to extended data on table merchAnonymousCustomer
            Basket.SalePreparation().SaveBillToAddress(address);
            Basket.SalePreparation().SaveShipToAddress(address);

            // go to payment page - only the cash payment is installed
            return(RedirectToUmbracoPage(PaymentInfoId));
        }
Пример #2
0
        public async Task CreateAsync(AddressModel model)
        {
            if (model == null)
            {
                throw new NullReferenceException("Model can not be null!");
            }

            Address address = model.ToAddress();

            await _context.AddAsync(address);

            await _context.SaveChangesAsync();
        }
Пример #3
0
        public ActionResult SaveAddress(AddressModel model)
        {
            if(model.AddressType == AddressType.Custom) throw new InvalidOperationException("We are not handling Custom Address Types in this example");

            if (!ModelState.IsValid) return CurrentUmbracoPage();

            // Rosetta extension method "ToAddress()"
            var address = model.ToAddress();

            // Basket has an extension method that handles the "BasketSalesPrepartion" instantiation
            // SalesPrepartionBase is responsible for persisting information needed to facilitate an order
            // while we are collecting enough information to create an invoice and eventually an order.
           

            // Addresses are saved to either an AnonymousCustomer (version 1.1.x) or potentially an established
            // customer (assuming they have logged in).  Established, or persisted customers are slated to be introduced
            // in Merchello Version 1.3.0.  No code change will be required here as the "conversion" will be handled in the
            // "CustomerContext"

            int proceed;
            // Hacky for this example but we are hard coding the "proceed" (Umbraco Content Id) for the next steps

            // 1075 Shipment Rate Quotes
            // 1077 confirmation

            if (model.AddressType == AddressType.Shipping)
            {
                Basket.SalePreparation().SaveShipToAddress(address);
                proceed = 1075;
            }
            else
            {
                Basket.SalePreparation().SaveBillToAddress(address);
                proceed = 1077;
            }

            return RedirectToUmbracoPage(proceed);

        }
Пример #4
0
        public ActionResult SaveAddress(AddressModel model)
        {
            // Error checking defined in AddressModel
            if (!ModelState.IsValid)
            {
                return(CurrentUmbracoPage());
            }

            if (model.AddressType == AddressType.Custom)
            {
                throw new InvalidOperationException("We are not handling Custom Address Types in this example");
            }

            // Rosetta extension method "ToAddress()"
            var address = model.ToAddress();

            // Basket has an extension method that handles the "BasketSalesPrepartion" instantiation

            // SalesPrepartionBase is responsible for persisting information needed to facilitate a sale (in this case an order)
            // while we are collecting enough information to create an invoice.

            // Addresses are saved to either an AnonymousCustomer (version 1.1.x) or potentially an established
            // customer (assuming they have logged in).  Established, or persisted customers are slated to be introduced
            // in Merchello Version 1.3.0.  No code change will be required here as the "conversion" will be handled in the
            // "CustomerContext"

            if (model.AddressType == AddressType.Shipping)
            {
                Basket.SalePreparation().SaveShipToAddress(address);
            }
            else
            {
                // This workflow never uses this as we combined this call with the select payment information
                Basket.SalePreparation().SaveBillToAddress(address);
            }

            return(RedirectToUmbracoPage(ShipRateQuoteId));
        }