public Task <IActionResult> Convert(decimal amount, string from, string to)
 => Yahoo.GetRate(from + to)
 .OrElse(() => CurrencyLayer.GetRate(from + to))
 .Map(rate => amount * rate)
 .Map(
     Faulted: ex => StatusCode(500, Errors.UnexpectedError),
     Completed: result => Ok(result) as IActionResult);
Esempio n. 2
0
 public static Task <decimal> GetRate(string ccyPair) =>
 CurrencyLayer.GetRate(ccyPair)
 .OrElse(() => Yahoo.GetRate(ccyPair));