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); }
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); }
public HttpResponseMessage MoveToWishlist(ItemCacheInstruction instruction) { var customer = GetCustomer(instruction); if (customer == null) { return Request.CreateResponse(HttpStatusCode.NotFound); } var basket = customer.Basket(); basket.MoveItemToWishList(instruction.EntityKey); return Request.CreateResponse(HttpStatusCode.OK); }