Пример #1
0
        /// <summary>
        /// Delete a cart
        /// </summary>
        /// <param name="param">Parameters to be used for deleting</param>
        /// <returns>Http web response of deleting operation</returns>
        public virtual async Task <HttpWebResponse> DeleteCartAsync(DeleteCartParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException(nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.Scope))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.Scope)), nameof(param));
            }
            if (param.CultureInfo == null)
            {
                throw new ArgumentException(GetMessageOfNull(nameof(param.CultureInfo)), nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.CartName))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.CartName)), nameof(param));
            }
            if (param.CustomerId == Guid.Empty)
            {
                throw new ArgumentException(GetMessageOfEmpty(nameof(param.CustomerId)), nameof(param));
            }

            DeleteCartRequest request = new DeleteCartRequest
            {
                CartName    = param.CartName,
                CultureName = param.CultureInfo.Name,
                CustomerId  = param.CustomerId,
                ScopeId     = param.Scope
            };
            CacheKey cacheKey = BuildCartCacheKey(param.Scope, param.CustomerId, param.CartName);
            await CacheProvider.RemoveAsync(cacheKey);

            return(await OvertureClient.SendAsync(request));
        }
        public DeleteCartResponse DeleteCart(DeleteCartRequest request)
        {
            DeleteCartResponse response = new DeleteCartResponse();

            response.delete = BaseBLL <TakeBLL> .Instance.DeleteCart(request.id);

            response.State = true;
            return(response);
        }
Пример #3
0
 public bool DeleteCart(DeleteCartRequest request)
 {
     try
     {
         _logger.LogInformation("Enter");
         var result = _cartRepository.DeleteCart(request.UserId);
         _logger.LogInformation("Exit");
         return(result);
     }
     catch (Exception e)
     {
         _logger.LogError($"Exception {e}");
         return(false);
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DeleteCartTest"/> class.
        /// </summary>
        public DeleteCartTest()
        {
            this.visitorId = Guid.NewGuid();
            this.cart      = new Cart {
                ExternalId = this.visitorId.ToString()
            };
            this.request = new DeleteCartRequest(this.cart);
            this.result  = new CartResult();
            this.args    = new ServicePipelineArgs(this.request, this.result);

            this.client = Substitute.For <ICartsServiceChannel>();

            var clientFactory = Substitute.For <ServiceClientFactory>();

            clientFactory.CreateClient <ICartsServiceChannel>(Arg.Any <string>(), Arg.Any <string>()).Returns(this.client);

            this.processor = new DeleteCart {
                ClientFactory = clientFactory
            };
        }
Пример #5
0
 public DeleteCartResponse DeleteCart(DeleteCartRequest request)
 {
     return(ApiRequestHelper.Post <DeleteCartRequest, DeleteCartResponse>(request));
 }
 public JsonResult DeleteCartInfo(DeleteCartRequest request)
 {
     return(Json(bll.DeleteCart(request)));
 }