public async Task <IEnumerable <DocumentDto> > Handle(AllDocumentsQuery request, CancellationToken cancellationToken) { var all = await PublishContext .Set <Document>() .ToListAsync(cancellationToken); return(all.Select(x => DocumentDto.Create(x, HttpContextAccessor)));; }
public async Task <IActionResult> GetAllOrdered(CancellationToken cancellationToken) { Logger.LogInformation("Get all documents"); var query = new AllDocumentsQuery(); var docs = await Mediator.Send(query, cancellationToken); return(Ok(docs.OrderBy(x => x.Name))); }