public async Task <IActionResult> LoadTable([FromBody] DataTablesParameters param) { try { HttpContext.Session.SetString(nameof(DataTablesParameters), JsonConvert.SerializeObject(param)); var filtersModel = JsonConvert.DeserializeObject <ExpertiseFilterViewModel>(param.FiltersObject); var results = await _expertiseService.GetDataTableAsync(param, filtersModel, Lng); var expertises = await Task.WhenAll(results.Items.Select(async(x) => new ExpertiseListViewModel { Id = x.Id, Name = x.Name, Category = x.Category, CategoryId = x.CategoryId, Description = x.Description, ActionsHtml = await this.RenderViewToStringAsync("_ExpertiseItemActions", x.Id) }).ToList()); return(new JsonResult(new DataTablesResult <ExpertiseListViewModel> { Draw = param.Draw, Data = expertises.ToList(), RecordsFiltered = results.TotalSize, RecordsTotal = results.TotalSize })); } catch (Exception e) { Console.Write(e.Message); return(new JsonResult(new { error = "Internal Server Error" })); } }