Example #1
0
        public async Task <ActionResult> ChangeCurrency(ChangeCurrencyVM changeCurrency)
        {
            int    fromCurrencyCodeInt = _currencyCodesResolver.Resolve(changeCurrency.FromCurrencyCode);
            int    toCurrencyCodeInt   = _currencyCodesResolver.Resolve(changeCurrency.ToCurrencyCode);
            Result result = await _accountService.ChangeCurrencyAsync(changeCurrency.UserId, changeCurrency.Amount, fromCurrencyCodeInt, toCurrencyCodeInt);

            return(ProcessResult(result));
        }
Example #2
0
        public async Task <HttpResponseMessage> ChangeCurrency(long userId, decimal money, string fromCurrency, string toCurrency)
        {
            ChangeCurrencyVM changeCurrencyVM = new ChangeCurrencyVM()
            {
                Amount = money, FromCurrencyCode = fromCurrency, ToCurrencyCode = toCurrency, UserId = userId
            };
            string        json = JsonConvert.SerializeObject(changeCurrencyVM);
            StringContent data = new StringContent(json, Encoding.UTF8, "application/json");

            return(await _client.PutAsync($"/account/ChangeCurrency", data));
        }