Пример #1
0
        public void Seed()
        {
            #region PaymentMethods

            var enumType = typeof(Core.Common.Data.Payment.PaymentMethod);
            foreach (var value in Enum.GetValues(enumType))
            {
                var id = (int)value;
                if (PaymentMethods.All(o => o.Id != id))
                {
                    PaymentMethods.Add(new PaymentMethod
                    {
                        Key  = Guid.NewGuid(),
                        Id   = id,
                        Code = Enum.GetName(enumType, value)
                    });
                }
            }
            SaveChanges();

            #endregion

            #region MatchingCriterias

            enumType = typeof(MatchingCriteriaEnum);
            foreach (var value in Enum.GetValues(enumType))
            {
                var id = (int)value;
                if (PaymentMethods.All(o => o.Id != id))
                {
                    MatchingCriterias.Add(new MatchingCriteria
                    {
                        Key  = Guid.NewGuid(),
                        Id   = (MatchingCriteriaEnum)id,
                        Code = Enum.GetName(enumType, value)
                    });
                }
            }

            SaveChanges();

            #endregion
        }
Пример #2
0
 public override IEnumerable <IGatewayResource> ListResourcesOffered()
 {
     return(AvailableResources.Where(x => PaymentMethods.All(y => y.PaymentCode != x.ServiceCode)));
 }
 /// <summary>
 /// Returns a list of remaining available resources
 /// </summary>
 /// <returns>
 /// The collection of <see cref="IGatewayResource"/>.
 /// </returns>
 public override IEnumerable <IGatewayResource> ListResourcesOffered()
 {
     // PaymentMethods is created in PaymentGatewayProviderBase.  It is a list of all previously saved payment methods
     return(AvailableResources.Where(x => PaymentMethods.All(y => y.PaymentCode != x.ServiceCode)));
 }