예제 #1
0
파일: Address.cs 프로젝트: christattum/Kona
        public static Address SaveIfNotExists(Address address) {

            if (!Address.Exists(x => x.UserName == address.UserName &&
                x.Street1 == address.Street1 &&
                x.StateOrProvince == address.StateOrProvince)) {

                address.Add(address.UserName);

            } else {
                address = Address.SingleOrDefault(x => x.UserName == address.UserName &&
                x.Street1 == address.Street1 &&
                x.StateOrProvince == address.StateOrProvince);
            }

            return address;

        }
예제 #2
0
        public ActionResult Shipping(Kona.Data.Address address)
        {
            if (ModelState.IsValid)
            {
                //save the address
                this.CurrentCart.ShippingAddress = Address.SaveIfNotExists(address);

                //calc the tax
                this.CurrentCart.TaxAmount = _pluginEngine.CalculateTax(this.SiteData.TaxPlugin, this.CurrentCart);

                //save the cart
                //_customerService.SaveCustomer(this.CurrentCustomer);
                this.CurrentCart.Save();

                //send to billing
                return(RedirectToAction("Billing"));
            }
            else
            {
                //let error handling pick it up
                return(View("Shipping"));
            }
        }
예제 #3
0
        public ActionResult Billing(Kona.Data.Address address)
        {
            if (ModelState.IsValid)
            {
                //save the address
                this.CurrentCart.BillingAddress = Address.SaveIfNotExists(address);;

                //set the shipping methods
                this.ShippingMethods = _pluginEngine.CalculateShipping(this.SiteData.ShippingPlugin, this.CurrentCart);;

                //default to the first
                this.CurrentCart.SetSelectedShipping(this.ShippingMethods[0]);

                //save the cart
                this.CurrentCart.Save();

                //send them to Finalize
                return(RedirectToAction("Finalize"));
            }
            else
            {
                return(View("Billing"));
            }
        }