Ejemplo n.º 1
0
        public Address SaveShippingAddress(Member member, AddressViewModel viewModel)
        {
            Guid addressId = viewModel.Guid;

            Address address = new Address(member.Guid, AddressType.Shipping, addressId, viewModel.Address, viewModel.SuburbCity, viewModel.State, viewModel.Postcode.Value, viewModel.FirstName, viewModel.LastName, null, null, viewModel.CompanyName);

            this._commandDispatcher.Dispatch<SaveAddressCommand>(new SaveAddressCommand(address));

            return address;
        }
Ejemplo n.º 2
0
        public Address SaveDeliveryAddress(Member member, AddressViewModel viewModel, string phoneNumber)
        {
            Guid addressId = viewModel.Guid;

            Address address = new Address(member.Guid, AddressType.Delivery, addressId, viewModel.Address, viewModel.SuburbCity, viewModel.State, viewModel.Postcode.Value, viewModel.FirstName, viewModel.LastName, null, phoneNumber, viewModel.CompanyName);

            this._commandDispatcher.Dispatch<SaveAddressCommand>(new SaveAddressCommand(address));

            return address;
        }
Ejemplo n.º 3
0
        public ActionResult ShippingInformation(AddressViewModel viewModel, Order order, Member member)
        {
            if (this.ModelState.IsValid)
            {
                Address shippingAddress = this._addressProvider.SaveShippingAddress(member, viewModel);
                this._commandDispatcher.Dispatch<AddShippingAddressCommand>(new AddShippingAddressCommand(order, shippingAddress));

                return this.RedirectToRoute(Routes.Checkout.PaymentInfo);
            }

            return this.View("ShippingInformation", viewModel);
        }
Ejemplo n.º 4
0
        public ActionResult ShippingInformation(Order order, Member member)
        {
            var viewModel = new AddressViewModel();

            if (order.ShippingAddressId.HasValue)
            {
                Address address = this._queryDispatcher.Dispatch<Address, GetAddressByGuidQuery>(new GetAddressByGuidQuery(order.ShippingAddressId.Value));
                viewModel = new AddressViewModel(address);
            }
            else if (member.ShippingAddresses.Any())
            {
                Address address = member.ShippingAddresses.OrderByDescending(o => o.DateCreated).First();
                viewModel = new AddressViewModel(address);
            }

            return this.View("ShippingInformation", viewModel);
        }