public async Task <Result <PurseDto> > FillUpPurse(MoneyTransactionParam param) { var availableCurrencies = await _currencyProvider.GetAvailableCurrencies(); if (!availableCurrencies.Contains(param.Currency)) { return(new Result <PurseDto>().SetUnprocessable($"Currency {param.Currency} not supported")); } var purse = await _purseRepository.GetOrCreatePurse(param.UserId.Value); purse.FillUp(param.Currency, param.Sum.Value); await _purseRepository.Commit(); return(new Result <PurseDto>(purse.ToDto())); }
public MainWindowViewModel(ICurrencyConverter currencyConverter, ICurrencyProvider currencyProvider) { _currencyConverter = currencyConverter; ConvertCommand = new RelayCommand(Convert, CanConvert); Currencies = new ObservableCollection <CurrencyCodes>(currencyProvider.GetAvailableCurrencies()); SelectedFromCurrency = Currencies.FirstOrDefault(); SelectedToCurrency = Currencies.LastOrDefault(); }