public ActionResult SelectAddress(AddressesViewModel addresses) { var currentUser = _authenticationService.GetAuthenticatedUser(); if (currentUser == null) throw new OrchardSecurityException(T("Login required")); if (!ModelState.IsValid) { return new ShapeResult(this, _services.New.Checkout_SelectAddress(Addresses: addresses)); } var customer = currentUser.ContentItem.As<CustomerPart>(); MapAddress(addresses.InvoiceAddress, "InvoiceAddress", customer); MapAddress(addresses.ShippingAddress, "ShippingAddress", customer); return RedirectToAction("Summary"); }
public ActionResult SelectAddress() { var currentUser = _authenticationService.GetAuthenticatedUser(); if (currentUser == null) throw new OrchardSecurityException(T("Login required")); var customer = currentUser.ContentItem.As<CustomerPart>(); var invoiceAddress = _customerService.GetAddress(customer.Id, "InvoiceAddress"); var shippingAddress = _customerService.GetAddress(customer.Id, "ShippingAddress"); var addressesViewModel = new AddressesViewModel { InvoiceAddress = MapAddress(invoiceAddress), ShippingAddress = MapAddress(shippingAddress) }; var shape = _services.New.Checkout_SelectAddress(Addresses: addressesViewModel); if (string.IsNullOrWhiteSpace(addressesViewModel.InvoiceAddress.Name)) addressesViewModel.InvoiceAddress.Name = string.Format("{0} {1} {2}", customer.Title, customer.FirstName, customer.LastName); return new ShapeResult(this, shape); }