Beispiel #1
0
        public async Task <ActionResult> AddOrUpdateShipmentJson(string shipmentId, Address shippingAddress, string[] itemIds, string shippingMethodCode)
        {
            EnsureThatCartExist();

            //Need lock to prevent concurrent access to same cart
            using (var lockObject = await AsyncLock.GetLockByKey(GetAsyncLockCartKey(WorkContext.CurrentCart.Id)).LockAsync())
            {
                await _cartBuilder.AddOrUpdateShipmentAsync(shipmentId, shippingAddress, itemIds, shippingMethodCode);

                await _cartBuilder.SaveAsync();
            }

            return(Json(null, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public async Task <ActionResult> AddOrUpdateCartShipment(ShipmentUpdateModel shipment)
        {
            EnsureThatCartExist();

            //Need lock to prevent concurrent access to same cart
            using (var lockObject = await AsyncLock.GetLockByKey(GetAsyncLockCartKey(WorkContext.CurrentCart.Id)).LockAsync())
            {
                await _cartBuilder.AddOrUpdateShipmentAsync(shipment);

                await _cartBuilder.SaveAsync();
            }

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }