public JsonResult GetAllUser(jQueryDataTableParamModel param) { try { List <User_Master> allRecords = new List <User_Master>(); allRecords = MS.GetAllUser(); List <User_Master> filteredRecords = null; if (!string.IsNullOrWhiteSpace(param.sSearch)) { allRecords = allRecords.Where(t => t.Email.Contains(param.sSearch) || t.UserName != null ? t.UserName.Contains(param.sSearch) : t.UserName == null).ToList(); filteredRecords = allRecords.Skip(param.iDisplayStart).Take(param.iDisplayLength).ToList(); } else { filteredRecords = allRecords .Skip(param.iDisplayStart) .Take(param.iDisplayLength).OrderBy(t => t.Email).ToList(); } int totalRecords = allRecords.Count(); var result = from c in filteredRecords select new[] { "", c.Id.ToString(), c.Email, c.UserName, c.IsActive == true ? "Active" : "InActive", c.IsVerified == null || c.IsVerified == false ? "Not Verified" : "IsVerified", MS.GetRoleName(c.RoleId.Value), "" }; return(Json(new { sEcho = param.sEcho, iTotalRecords = totalRecords, iTotalDisplayRecords = totalRecords, aaData = result }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { CommonServices.ErrorLogging(ex); return(Json(new { sEcho = 1, iTotalRecords = 0, iTotalDisplayRecords = 0, aaData = new List <string[]> { } }, JsonRequestBehavior.AllowGet)); } }