public virtual async Task <CurrencyViewModel> GetScopeCurrencyAsync(GetScopeCurrencyParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException(nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.Scope))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.Scope)), nameof(param));
            }
            if (param.CultureInfo == null)
            {
                throw new ArgumentException(GetMessageOfNull(nameof(param.CultureInfo)), nameof(param));
            }

            var p = new GetScopeParam
            {
                Scope = param.Scope
            };

            var scope = await ScopeRepository.GetScopeAsync(p).ConfigureAwait(false);

            CurrencyViewModel vm = null;

            if (scope?.Currency != null)
            {
                vm = ViewModelMapper.MapTo <CurrencyViewModel>(scope.Currency, param.CultureInfo);
            }

            return(vm);
        }
Exemplo n.º 2
0
 private void InitializeScopeItem()
 {
     if (_scopeItem == null)
     {
         var p = new GetScopeParam
         {
             Scope = Scope
         };
         _scopeItem = ScopeRepository.GetScopeAsync(p).ConfigureAwait(false).GetAwaiter().GetResult();
     }
 }