Advertisement
ekkis

Untitled

Aug 10th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. string json = new WebClient().DownloadString("http://api.bitcoincharts.com/v1/weighted_prices.json");
  2. JObject jo = JObject.Parse(json);
  3.  
  4. foreach (Currency c in db.Currencies.Where(x => x.Enabled))
  5. {
  6. if (c.FXRate == null) c.FXRate = new FXRate();
  7. c.FXRate.Value = Convert.ToDecimal(jo[c.ISO]["7d"].ToString());
  8. c.FXRate.EffectiveTs = DateTime.Now;
  9. }
  10. db.SaveChanges();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement