Ejemplo n.º 1
0
        private void AddPseudoSkusToSubscription(IList <int> pseudoSkusToAdd, Subscription subscription)
        {
            PseudoSku pseudoSku;

            if (pseudoSkusToAdd.Count() > 0)
            {
                foreach (int pseudoSkuId in pseudoSkusToAdd)
                {
                    pseudoSku = _pseudoSkuRepository.FindBy(pseudoSkuId);
                    subscription.Add(pseudoSku);
                }
            }
        }
        //Gives pseudo SKUs that match a criterion of category, color, function and size
        private IEnumerable <PseudoSku> GetAllPseudoSkusMatchingQueryAndSort(GetPseudoSkusByCategoryRequest request, Query pseudoSkuQuery)
        {
            IEnumerable <PseudoSku> pseudoSkusMatchingRefinement = _pseudoSkuRepository.FindBy(pseudoSkuQuery);

            switch (request.SortBy)
            {
            case PseudoSkusSortBy.PriceLowToHigh:
                pseudoSkusMatchingRefinement = pseudoSkusMatchingRefinement.OrderBy(p => p.Price);
                break;

            case PseudoSkusSortBy.PriceHighToLow:
                pseudoSkusMatchingRefinement = pseudoSkusMatchingRefinement.OrderByDescending(p => p.Price);
                break;
            }
            return(pseudoSkusMatchingRefinement);
        }