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)); }
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)); }