using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace CurrencyExchangeLib
{
    public class VendorRateWebService : IVendorRateWebService
    {
        public double GetExchange(string vendor, string currency)
        {
            var result = new WebClient().DownloadString(
                String.Format("http://www.agiledeveloper.com:8084?vendor={0}&currency={1}", 
                    vendor, currency));
            try
            {
                return Double.Parse(result);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
    }
}
