コード例 #1
0
        public ActionResult Index(GiftCardPage currentPage)
        {
            var model = new GiftCardViewModel(currentPage)
            {
                CurrentContent = currentPage,
                GiftCardList   = _giftCardService.GetCustomerGiftCards(CustomerContext.Current.CurrentContactId.ToString()).ToList()
            };

            return(View(model));
        }
コード例 #2
0
        public IEnumerable <PaymentMethodViewModel> GetPaymentMethodViewModels()
        {
            var currentMarket              = _currentMarket.GetCurrentMarket().MarketId;
            var currentLanguage            = _languageService.GetCurrentLanguage().TwoLetterISOLanguageName;
            var availablePaymentMethods    = _paymentService.GetPaymentMethodsByMarketIdAndLanguageCode(currentMarket.Value, currentLanguage);
            var availableCustomerGiftCards = _giftCardService.GetCustomerGiftCards(CustomerContext.Current.CurrentContactId.ToString()).Where(g => g.IsActive == true);

            var displayedPaymentMethods = availablePaymentMethods
                                          .Where(p => _paymentOptions.Any(m => m.PaymentMethodId == p.PaymentMethodId))
                                          .Select(p => new PaymentMethodViewModel(_paymentOptions.First(m => m.PaymentMethodId == p.PaymentMethodId))
            {
                IsDefault = p.IsDefault
            })
                                          .ToList();

            if (availableCustomerGiftCards.Any() == false)
            {
                displayedPaymentMethods.RemoveAll(x => x.SystemKeyword == "GiftCardPayment");
            }

            return(displayedPaymentMethods);
        }