public async Task GetEventsAsync(int page, DateTime?startingTs, LogQueryFilter queryFilter) { var events = await _repository.GetEventsPageAsync(page == 0? 1 : page, startingTs, queryFilter); _context.Response.ContentType = "application/json"; await _context.Response.WriteAsync(JsonConvert.SerializeObject(events, _camelCaseSerializerSetting)); }
public async Task GetEventsAsync(int page, DateTime?startingTs, LogQueryFilter queryFilter) { var events = await _repository.GetEventsPageAsync(page == 0? 1 : page, startingTs, queryFilter); _context.Response.ContentType = "application/json"; await _context.Response.WriteAsync(JsonSerializer.Serialize(events, ApplicationBuilderExtensions._camelCaseJson)); }
public async Task GetEventsAsync(int page, DateTime?startingTs, LogQueryFilter queryFilter) { try { var events = await _repository.GetEventsPageAsync(page == 0? 1 : page, startingTs, queryFilter); _context.Response.ContentType = "application/json"; await _context.Response.WriteAsync(JsonSerializer.Serialize(events, ApplicationBuilderExtensions._camelCaseJson)); } catch (QueryEngineException ex) { _context.Response.ContentType = "application/json"; _context.Response.StatusCode = StatusCodes.Status400BadRequest; await _context.Response.WriteAsync(JsonSerializer.Serialize(new { error = ex.Message }, ApplicationBuilderExtensions._camelCaseJson)); } }