Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        public JsonResult UpdateItems(JsonBasketQtyUpdateRequest jsonBasketQtyUpdateRequest)
        {
            ModifyBasketRequest request = new ModifyBasketRequest();

            request.BasketId = base.GetBasketId();
            request.ItemsToUpdate = jsonBasketQtyUpdateRequest.ConvertToBasketItemUpdateRequests(); ;

            BasketDetailView basketDetailView = new BasketDetailView();
            ModifyBasketResponse response = _basketService.ModifyBasket(request);

            SaveBasketSummaryToCookie(response.Basket.NumberOfItems,
                                      response.Basket.BasketTotal);

            basketDetailView.BasketSummary = new BasketSummaryView()
            {
                BasketTotal = response.Basket.BasketTotal,
                NumberOfItems = response.Basket.NumberOfItems
            };

            basketDetailView.Basket = response.Basket;

            basketDetailView.DeliveryOptions = _basketService.GetAllDispatchOptions().DeliveryOptions;

            return Json(basketDetailView);
        }
Ejemplo n.º 3
0
        public JsonResult UpdateShipping(int shippingServiceId)
        {
            ModifyBasketRequest request = new ModifyBasketRequest();
            request.SetShippingServiceIdTo = shippingServiceId;
            request.BasketId = base.GetBasketId();

            BasketDetailView basketDetailView = new BasketDetailView();

            ModifyBasketResponse response = _basketService.ModifyBasket(request);

            SaveBasketSummaryToCookie(response.Basket.NumberOfItems, response.Basket.BasketTotal);

            basketDetailView.BasketSummary = new BasketSummaryView()
            {
                BasketTotal = response.Basket.BasketTotal,
                NumberOfItems = response.Basket.NumberOfItems
            };

            basketDetailView.Basket = response.Basket;
            basketDetailView.DeliveryOptions = _basketService.GetAllDispatchOptions().DeliveryOptions;

            return Json(basketDetailView);
        }
Ejemplo n.º 4
0
        public JsonResult RemoveItem(int productId)
        {
            ModifyBasketRequest request = new ModifyBasketRequest();
            request.ItemsToRemove.Add(productId);

            request.BasketId = base.GetBasketId();

            ModifyBasketResponse response = _basketService.ModifyBasket(request);

            SaveBasketSummaryToCookie(response.Basket.NumberOfItems, response.Basket.BasketTotal);

            BasketDetailView basketDetailView = new BasketDetailView();

            basketDetailView.BasketSummary = new BasketSummaryView()
            {
                BasketTotal = response.Basket.BasketTotal,
                NumberOfItems = response.Basket.NumberOfItems
            };

            basketDetailView.Basket = response.Basket;
            basketDetailView.DeliveryOptions = _basketService.GetAllDispatchOptions().DeliveryOptions;

            return Json(basketDetailView);
        }