public ActionResult CacheTest(int?id) { if (ViewData.Model == null) //nem volt a cache-ben { ViewData.Model = CacheDemoModel.GetModell(id ?? 1); } return(View()); }
public ActionResult CacheTestPost(int?id) { if (!id.HasValue) { return(RedirectToAction("Index")); } var model = CacheDemoModel.GetModell(id.Value); TryUpdateModel(model); return(View(model)); }
public ActionResult CacheTestPost(int?id) { if (!id.HasValue) { return(RedirectToAction("Index")); } CacheDemoModel originalModel = ViewData["originalModel"] as CacheDemoModel; if (originalModel == null) { originalModel = CacheDemoModel.GetModell(id.Value); } if (TryUpdateModel <CacheDemoModel>(originalModel)) { return(RedirectToAction("Index")); } return(View(originalModel)); }
public ActionResult CacheTestProfile(int?id) { return(View("CacheTestHeader", CacheDemoModel.GetModell(id ?? 1))); }
public ActionResult CacheTestHeader(int?id) { return(View(CacheDemoModel.GetModell(id ?? 1))); }
[OutputCache(Duration = 10)] //Nincs szükség a VaryByParam = "Id"-re mert action paraméter //[OutputCache(Duration = 10, VaryByParam = "none")] //Ebben az esetben nem jó működés, mert nem veszi figyelembe az Id-t public ActionResult CacheTestChild1(int?id) { return(PartialView("CacheTestChild", CacheDemoModel.GetModell(id ?? 1))); }