Пример #1
0
        protected async ValueTask <ActionResult <TResult> > ExecuteRequest <TResult>(CacheableRequest <TResult> request)
        {
            HttpContext.AddCachePrefernces(request);

            var result = await ExecuteRequestImpl(request)
                         .ConfigureAwait(false);

            HttpContext.AddFromCacheHeader(request);

            return(result);
        }
Пример #2
0
        public async Task <ActionResult <IEnumerable <TransactionModel> > > GetTransactions([FromQuery] Paging paging, [FromQuery] Filter filter, [FromQuery] Order?order)
        {
            var query = new GetTransactionsQuery
            {
                Paging = paging,
                Filter = filter,
                Order  = order
            };

            HttpContext.AddCachePrefernces(query);

            var result = await Mediator.Send(query, HttpContext.RequestAborted)
                         .ConfigureAwait(false);

            if (result.IsFailure)
            {
                return(result.Error.AsErrorActionResult());
            }

            HttpContext.AddPaging(result.Value.Paging);
            HttpContext.AddFromCacheHeader(query);

            return(Ok(result.Value.Transactions));
        }