Пример #1
0
 public static RegulatorEntity Update(RegulatorEntity from, IRegulator to)
 {
     from.Name                    = to.Name;
     from.InternalId              = to.InternalId;
     from.IsDefault               = to.IsDefault;
     from.Countries               = to.Countries;
     from.TermsOfUseUrl           = to.TermsOfUseUrl;
     from.MarginTradingConditions = to.MarginTradingConditions;
     from.CreditVoucherUrl        = to.CreditVoucherUrl;
     from.RiskDescriptionUrl      = to.RiskDescriptionUrl;
     return(Create(from));
 }
Пример #2
0
        public async Task <IRegulator> GetByIdOrDefaultAsync(string id)
        {
            if (!string.IsNullOrEmpty(id))
            {
                var regulator = await _tableStorage.GetDataAsync(RegulatorEntity.GeneratePartition(), RegulatorEntity.GenerateRowKey(id));

                if (regulator != null)
                {
                    return(regulator);
                }
            }

            var allRegulators = await _tableStorage.GetDataAsync(RegulatorEntity.GeneratePartition());

            var defaultRegulators = allRegulators.Where(r => r.IsDefault).ToArray();

            if (defaultRegulators.Length == 1)
            {
                return(defaultRegulators.Single());
            }

            return(null);
        }
Пример #3
0
 public Task RemoveAsync(string id)
 {
     return(_tableStorage.DeleteAsync(RegulatorEntity.GeneratePartition(), RegulatorEntity.GenerateRowKey(id)));
 }