override public string read() { JSONCreateRateObj dr = new JSONCreateRateObj(); UrlParams postparams = parser.parsePostBody(postbody); dr.data = DataManager.getInstance().getCurrencyRates(postparams.Start, postparams.Limit, postparams.Date.Date); dr.results = DataManager.getInstance().getCurrencyRatesCount(); dr.success = true; return(js.Serialize(dr)); }
override public string update() { JSONCreateRateObj dr = js.Deserialize <JSONCreateRateObj>(postbody); foreach (JSONCurrencyRate dc in dr.data) { CurrencyRate rate = DataManager.getInstance().getCurrencyRateById(dc.id); rate.date = DateTime.Parse(dc.date); rate.rate = dc.rate; dr.results++; } DataManager.getInstance().commit(); dr.success = true; return(js.Serialize(dr)); }