public virtual async Task <ActionResult <GetFactResponse> > GetFact([FromQuery] GetArguments args, CancellationToken cancellation) { return(await ControllerUtilities.InvokeActionImpl(async() => { using var _ = _instrumentation.Block("Controller GetFact"); // Calculate server time at the very beginning for consistency var serverTime = DateTimeOffset.UtcNow; // Retrieves the raw data from the database, unflattend, untrimmed var service = GetFactService(); var(data, isPartial, count) = await service.GetFact(args, cancellation); // Prepare the result in a response object var result = new GetFactResponse { IsPartial = isPartial, ServerTime = serverTime, Result = data, TotalCount = count }; return Ok(result); }, _logger)); }
public virtual async Task <ActionResult <GetFactResponse> > GetFact([FromQuery] FactArguments args, CancellationToken cancellation) { // Calculate server time at the very beginning for consistency var serverTime = DateTimeOffset.UtcNow; // Retrieves the raw data from the database, unflattend, untrimmed var service = GetFactService(); var result = await service.GetFact(args, cancellation); var data = result.Data; var count = result.Count; // Prepare the result in a response object var response = new GetFactResponse { ServerTime = serverTime, Result = data, TotalCount = count }; return(Ok(response)); }