Created
August 31, 2017 22:51
Revisions
-
ChaosEngine created this gist
Aug 31, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ [HttpGet] public async Task<IActionResult> Load(string sort, string order, string search, int limit, int offset, string extraParam) { CancellationToken token = HttpContext.RequestAborted; try { var found = await _repo.SearchAsync(sort, order, search, offset, limit, token); var result = new { total = found.Count, rows = found.Itemz }; var content = JsonConvert.SerializeObject(result, Formatting.None, new JsonSerializerSettings() { MetadataPropertyHandling = MetadataPropertyHandling.Ignore }); return Content(content, "application/json"); } catch (OperationCanceledException ex) { _logger.LogError(ex, $"Cancelled {nameof(Load)}::{nameof(_repo.SearchAsync)}({sort}, {order}, {search}, {offset}, {limit}, {token})"); return Ok(); } catch (Exception ex) { _logger.LogError(ex, $"{nameof(Load)}::{nameof(_repo.SearchAsync)}({sort}, {order}, {search}, {offset}, {limit}, {token})"); throw; } }