public JsonResult GetAllCallingPrice(jQueryDataTableParamModel param) { try { var allRecords = new List <CallingPriceMaster>(); allRecords = MS.GetAllCallingPrices(); List <CallingPriceMaster> filteredRecords = null; if (!string.IsNullOrWhiteSpace(param.sSearch)) { allRecords = allRecords.Where(t => t.Name.Contains(param.sSearch) || t.Price.Value.ToString().Contains(param.sSearch)).OrderBy(t => t.Name).ToList(); filteredRecords = allRecords.Skip(param.iDisplayStart).Take(param.iDisplayLength).ToList(); } else { filteredRecords = allRecords .Skip(param.iDisplayStart) .Take(param.iDisplayLength).OrderBy(t => t.Name).ToList(); } int totalRecords = allRecords.Count(); var result = from c in filteredRecords select new[] { "", c.Id.ToString(), c.Name.ToString(), Convert.ToString(c.Time), Convert.ToString(c.Price.Value), c.IsActive == true ? "Active" : "InActive", "" }; 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)); } }