示例#1
0
 public ActionResult ShippingMethods()
 {
     WebStoreConfigurationPart configuration = this._webStoreConfigurationServices.GetConfiguration();
     WebStoreServices webStoreServices = new WebStoreServices(configuration);
     Basket basket = this._basketServices.GetBasket();
     ShippingMethodsViewModel viewModel = new ShippingMethodsViewModel { AvailableShippingMethods = webStoreServices.CreateWebStoreChannel<IOrderService>().GetShippingMethods(new GetShippingMethodsParameters { BasketId = this._basketServices.GetBasketId().Value, CultureName = Thread.CurrentThread.CurrentUICulture.Name, MerchantId = configuration.MerchantId.Value, UserId = this._webstoreProfileServices.GetUser() }), Currency = basket.Currency, ShippingMethod = basket.OrderFormHeaders.First().LineItems.First().ShippingMethodId.ToString() };
     webStoreServices.Dispose();
     this.Response.Cache.SetCacheability(HttpCacheability.NoCache);
     return this.View("~/Modules/WebStore/Views/Order/ShippingMethods.cshtml", viewModel);
 }
示例#2
0
 public ActionResult ShippingMethods(ShippingMethodsViewModel viewModel)
 {
     WebStoreServices webStoreServices = new WebStoreServices(this._webStoreConfigurationServices.GetConfiguration());
     if (this.ModelState.IsValid)
     {
         IOrderService orderServices = webStoreServices.CreateWebStoreChannel<IOrderService>();
         orderServices.UpdateBasket(
             new UpdateBasketParameters
             {
                 BasketId = this._basketServices.GetBasketId().Value,
                 UserId = this._webstoreProfileServices.GetUser(),
                 ShippingMethodId = Guid.Parse(viewModel.ShippingMethod),
                 CultureName = Thread.CurrentThread.CurrentUICulture.Name,
                 CountryId = this.BillingAddress.ShippingAddressIsDifferent ? this.ShippingAddress.Country : this.BillingAddress.Country
             }
         );
         webStoreServices.Dispose();
         Basket b = this._basketServices.GetBasket();
         return this.View("~/Modules/WebStore/Views/Order/Pay.cshtml", new PayViewModel { Total = b.Total, ShippingCost = b.ShippingTotal, SubTotal = b.SubTotal, Currency = b.Currency });
     }
     else
     {
         viewModel.AvailableShippingMethods = webStoreServices.CreateWebStoreChannel<IOrderService>().GetShippingMethods(new GetShippingMethodsParameters { BasketId = this._basketServices.GetBasketId().Value, CultureName = Thread.CurrentThread.CurrentUICulture.Name, MerchantId = this._webStoreConfigurationServices.GetConfiguration().MerchantId.Value, UserId = this._webstoreProfileServices.GetUser() });
         webStoreServices.Dispose();
     }
     return this.View(viewModel);
 }