public async Task <IActionResult> LoadTable([FromBody] DataTablesParameters param) { try { var filtersModel = JsonConvert.DeserializeObject <PrescriptionFilterViewModel>(param.FiltersObject); filtersModel.CenterId = CurrentLab.Id; var results = await _prescriptionRepository.GetDataTableAsync(param, filtersModel, Lng); var prescriptions = await Task.WhenAll(results.Items.Select(async(x) => new SonarPrescriptionListViewModel { Id = x.Id, CenterId = x.CenterId, TreatmentHistoryId = x.TreatmentHistoryId, Status = x.Status, SonarCenter = x.SonarCenter, StatusName = x.StatusName, Doctor = x.Doctor, Patient = x.Patient, CreateDate = x.CreateDate, ActionsHtml = await this.RenderViewToStringAsync("_PrescriptionItemActions", (x.Id, x.CenterId, x.TreatmentHistoryId, x.Status)) }).ToList()); return(new JsonResult(new DataTablesResult <SonarPrescriptionListViewModel> { Draw = param.Draw, Data = prescriptions.ToList(), RecordsFiltered = results.TotalSize, RecordsTotal = results.TotalSize })); }