Exemplo n.º 1
0
 public GetBasketResponse GetBasket(GetBasketRequest request)
 {
     GetBasketResponse response = new GetBasketResponse();
     Basket basket = _basketRepository.FindBy(request.BasketId);
     BasketView basketView;
     if (basket != null)
     {
         basketView = basket.ConvertToBasketView();
     }
     else
     {
         basketView = new BasketView();
     }
     response.Basket = basketView;
     return response;
 }
Exemplo n.º 2
0
        public ActionResult Detail()
        {
            BasketDetailView basketView = new BasketDetailView();
            Guid basketId = base.GetBasketId();

            GetBasketRequest basketRequest = new GetBasketRequest()
            {
                BasketId = basketId
            };

            GetBasketResponse basketResponse = _basketService.GetBasket(basketRequest);
            GetAllDispatchOptionsResponse dispatchOptionsResponse = _basketService.GetAllDispatchOptions();
            basketView.Basket = basketResponse.Basket;
            basketView.Categories = base.GetCategories();
            basketView.BasketSummary = base.GetBasketSummaryView();
            basketView.DeliveryOptions = dispatchOptionsResponse.DeliveryOptions;

            return View("View", basketView);
        }
        public ActionResult Checkout()
        {
            GetCustomerRequest customerRequest = new GetCustomerRequest()
            {
                CustomerIdentityToken = _formsAuthentication.GetAuthenticationToken()
            };
            GetCustomerResponse customerResponse = _customerService.GetCustomer(customerRequest);
            CustomerView customerView = customerResponse.Customer;

            if (customerView.DeliveryAddressBook.Count() > 0)
            {
                OrderConfirmationView orderConfirmationView = new OrderConfirmationView();
                GetBasketRequest getBasketRequest = new GetBasketRequest()
                {
                    BasketId = base.GetBasketId()
                };
                GetBasketResponse basketResponse = _basketService.GetBasket(getBasketRequest);
                orderConfirmationView.Basket = basketResponse.Basket;
                orderConfirmationView.DeliveryAddresses = customerView.DeliveryAddressBook;
                return View("ConfirmOrder", orderConfirmationView);
            }
            return AddDeliveryAddress();
        }