Пример #1
0
        public HttpResponseMessage MoveToBasket(ItemCacheInstruction instruction)
        {
            var customer = GetCustomer(instruction);

            if (customer == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            var wishlist = customer.WishList();

            wishlist.MoveItemToBasket(instruction.EntityKey);

            return(Request.CreateResponse(HttpStatusCode.OK));
        }
Пример #2
0
        public HttpResponseMessage RemoveItemCacheItem(ItemCacheInstruction instruction)
        {
            var itemCache = GetCustomerItemCache(instruction);

            if (itemCache == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            itemCache.RemoveItem(instruction.EntityKey);

            itemCache.Save();

            return(Request.CreateResponse(HttpStatusCode.OK));
        }
Пример #3
0
        public HttpResponseMessage UpdateLineItemQuantity(ItemCacheInstruction instruction)
        {
            var itemCache = GetCustomerItemCache(instruction);

            if (itemCache == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }


            var item = itemCache.Items.FirstOrDefault(x => x.Key == instruction.EntityKey);

            if (item == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            itemCache.Items.First(x => x.Key == instruction.EntityKey).Quantity = instruction.Quantity;

            itemCache.Save();

            return(Request.CreateResponse(HttpStatusCode.OK));
        }