Ejemplo n.º 1
0
        public async Task <ActionResult <List <ElectionMeta> > > GetBallots()
        {
            var result = await _resultsAggregator.GetAllBallots();

            if (result.IsSuccess)
            {
                return(result.Value);
            }
            return(StatusCode(500, result.Error));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <List <ElectionMeta> > > GetBallots()
        {
            var result = await _appCache.GetOrAddAsync(
                "ballots", () => _resultsAggregator.GetAllBallots(),
                DateTimeOffset.Now.AddMinutes(120));

            if (result.IsSuccess)
            {
                return(result.Value);
            }
            return(StatusCode(500, result.Error));
        }