public JsonResult GetAllCalling(jQueryDataTableParamModel param) { try { var allRecords = new List <Calling_Request>(); allRecords = MS.GetAllCalling(); List <Calling_Request> filteredRecords = null; if (!string.IsNullOrWhiteSpace(param.sSearch)) { allRecords = allRecords.Where(t => t.Id.ToString().Contains(param.sSearch.ToLower()) || t.User_Master1.FullName.ToString().Contains(param.sSearch.ToLower()) || t.User_Master1.FullName.ToLower().ToString().Contains(param.sSearch.ToLower())).OrderBy(t => t.Id).ToList(); filteredRecords = allRecords.Skip(param.iDisplayStart).Take(param.iDisplayLength).ToList(); } else { filteredRecords = allRecords .Skip(param.iDisplayStart) .Take(param.iDisplayLength).OrderBy(t => t.Id).ToList(); } int totalRecords = allRecords.Count(); var result = from c in filteredRecords select new[] { "", c.Id.ToString(), c.User_Master.FullName, c.User_Master1.FullName, c.TotalAmount.Value.ToString("0.00"), Convert.ToDateTime(c.CallingDateTime1).ToString("dd-MM-yyy HH:mm"), c.CallingDateTime2 != null?Convert.ToDateTime(c.CallingDateTime2).ToString("dd-MM-yyyy HH:mm") : "", c.CallingDateTime3 == null ? "" : Convert.ToDateTime(c.CallingDateTime3).ToString("dd-MM-yyyy HH:mm"), c.AcceptDatetime == null ? "" : Convert.ToDateTime(c.AcceptDatetime).ToString("dd-MM-yyyy HH:mm"), c.IsAccept.ToString(), c.IsReject.ToString(), c.RejectedNote }; 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)); } }