コード例 #1
0
        /// <summary>
        /// The get customer item cache.
        /// </summary>
        /// <param name="instruction">
        /// The instruction.
        /// </param>
        /// <returns>
        /// The <see cref="CustomerItemCacheBase"/>.
        /// </returns>
        /// <exception cref="NullReferenceException">
        /// Throws a null reference if the customer is not found
        /// </exception>
        private CustomerItemCacheBase GetCustomerItemCache(ItemCacheInstructionBase instruction)
        {
            var customer = GetCustomer(instruction);

            if (customer == null)
            {
                var notFound = new NullReferenceException("Customer was not found");
                MultiLogHelper.Error<BackOfficeCheckoutApiController>("Could not add item to customer ItemCache", notFound);
                return null;
            }

            return instruction.ItemCacheType == ItemCacheType.Wishlist
                       ? (CustomerItemCacheBase)customer.WishList()
                       : (CustomerItemCacheBase)customer.Basket();
        }
コード例 #2
0
 /// <summary>
 /// Gets the customer.
 /// </summary>
 /// <param name="instruction">
 /// The instruction.
 /// </param>
 /// <returns>
 /// The <see cref="ICustomer"/>.
 /// </returns>
 private ICustomer GetCustomer(ItemCacheInstructionBase instruction)
 {
     return _customerService.GetByKey(instruction.CustomerKey);
 }