public ActionResult GetRecords(string CurrentView, DateTime CurrentDate, string CurrentAction) { var data = AppointmentRepository.FilterAppointment(CurrentDate, CurrentAction, CurrentView); BatchDataResult result = new BatchDataResult(); result.result = data; result.count = AppointmentRepository.GetAllRecords().ToList().Count > 0 ? AppointmentRepository.GetAllRecords().ToList().Max(p => p.Id):1; return(Json(result, JsonRequestBehavior.AllowGet)); }