public string GetRate(string id) { long idRate = JsonConvert.DeserializeObject <Int32>(id); ResponseRateData tmp = GetRateDic(); return(JsonConvert.SerializeObject(tmp.RateDic[idRate])); }
ResponseRateData GetRateDic() { ResponseRateData result = new ResponseRateData(); try { var rates = DataLayer.Repository.GetRates(); foreach (var r in rates) { if (r != null && !String.IsNullOrEmpty(r.ClassName) && QuantLibAdaptor.GetRateInformation(r) ) { result.RateDic[r.Id] = r; } } DataLayer.Repository.RateDic = result.RateDic; } catch (Exception ex) { while (ex.InnerException != null) { ex = ex.InnerException; } result.Error = new CustomException(); result.Error.Message = ex.Message + ex.StackTrace; } //we read from the database from te table Currencies // assumption is - if ClassName is not null then the rest of the parameters for each currency should be populated for Quantlib // otherwise it was manually added and everything should be coming from the database only return(result); }
public string GetRates() { ResponseRateData tmp = GetRateDic(); return(JsonConvert.SerializeObject(tmp)); }