I would like to parse the decimal 4.4589 to 4.45. But, I couldnt have succeeded. I have tried to use
parseFloat(yourString).toFixed(2)
but it didnt work...
Please help me to parse the "BanknoteBuying" and "BanknoteSelling".
Thanks in advance
[HttpGet]
public ActionResult GetData()
{
XDocument doc = XDocument.Load("http://www.tcmb.gov.tr/kurlar/today.xml");
var dox = doc.Descendants()
.Where(r => r.Name == "Currency")
.Select(r => new {
Isim = r.Element("Isim").Value,
Kod = r.Attribute("Kod").Value,
AlisKur = r.Element("BanknoteBuying").Value,
SatisKur = r.Element("BanknoteSelling").Value
}).Where(x=>x.Isim== "ABD DOLARI"||x.Isim== "EURO");
return Json(dox, JsonRequestBehavior.AllowGet);
}