public ActionResult Currency() { var cache = MemoryCache.Default; var currencyModel = cache.Get("Currency"); if (currencyModel == null) { currencyModel = new CurrencyModel(); } return View(currencyModel); }
public ActionResult Currency(CurrencyModel model) { if (ModelState.IsValid) { var cache = MemoryCache.Default; cache.Remove("Currency"); cache.Add("Currency", model, DateTimeOffset.UtcNow.AddMinutes(8000)); } return View(model); }