public ActionResult GetAllEnquiries(string fromdate, string todate) { List <Enquiry> listEnquiies = null; DateTime dtStartDate = DateTime.ParseExact(fromdate, "dd/MM/yyyy", CultureInfo.InvariantCulture); DateTime dtEndDate = DateTime.ParseExact(todate, "dd/MM/yyyy", CultureInfo.InvariantCulture); string keyname = "Enquiry_" + fromdate + todate + (int)Session["UserId"]; if (RedisCacheHelper.keyExistsInCache(keyname)) { listEnquiies = RedisCacheHelper.GetCacheData <Enquiry>(keyname); } else { listEnquiies = manager.GetAllEnquires(dtStartDate, dtEndDate, (int)Session["UserId"]); RedisCacheHelper.addItemCache <Enquiry>(keyname, listEnquiies); } return(Json(listEnquiies.OrderBy(o => o.ID), JsonRequestBehavior.AllowGet)); }