public JsonResult GetAllPatientDetails_ForList(int?page, int?limit, string sortBy, string direction, string searchString = null) { try { PatientModel model = new PatientModel(); model.CurrentPage = page.Value; model.NumberOfRecords = limit.Value; model.OrderBy = string.Format("{0} {1}", sortBy, direction); var records = model.GetPatientData_ForList();//new GridModel().GetPlayers(page, limit, sortBy, direction, searchString, out total); int total = records.Count > 0 ? records.FirstOrDefault().TotalCount : 0; return(Json(new { records, total }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { UtilityController.LogException(ex, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name); } return(Json(null, JsonRequestBehavior.AllowGet)); }