public async Task<JsonResult<ValuteHistory>> Get() { CurrencyService currencyService = new CurrencyService(); var all = currencyService.Find(x => x.InsertDate.Date == DateTime.Now.Date); RequestHistory today = null; if (all.Any()) { today = all.First(); } if (today == null) { var data = currencyService.GetDailyData(); var valuteHistory = JsonConvert.SerializeObject(data); await currencyService.AddHistory(new RequestHistory() { InsertDate = DateTime.Now, History = valuteHistory }); return Json(data); } var history = JsonConvert.DeserializeObject<ValuteHistory>(today.History); return Json(history); }