|
-
Oct 30th, 2007, 04:40 PM
#1
Thread Starter
Frenzied Member
simple currency converter?
I'm trying to write a web service function in C# to be able to convert currencies between gbp,eur,usd
so if i called CurrencyConversion(gbp, usd, 10.00) it should convert 10 pounds into us dollars and return that, can someone give me an example how this could be done?
Code:
public class TestService : WebService
{
[WebMethod(Description = "GBP<->EUR<->USD currency conversion", EnableSession = false)]
public int CurrencyConversion(string currency1, string currency2, decimal amount)
{
}
}
-
Oct 30th, 2007, 10:34 PM
#2
Re: simple currency converter?
You'd need to parse the two currencies to determine which exchange rate to use, then simply multiply the amount by that value. Where you get your exchange rates from is up to you. Also, shouldn't that method return a decimal, not an int?
-
Nov 1st, 2007, 06:50 AM
#3
Thread Starter
Frenzied Member
Re: simple currency converter?
Yep, thanks, changed it to decimal.
If i now created an asp.net website within the same project, how would i call this service to test my currency converter service?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|