Exemple #1
0
        public async Task <PagedList <NoteDto> > Handle(ListNotesQuery request, CancellationToken cancellationToken)
        {
            var notes = await _context.Notes
                        .AsNoTracking()
                        .ProjectTo <NoteDto>(_mapper.ConfigurationProvider)
                        .Paginate(request, cancellationToken);

            return(notes);
        }
 public async Task <IActionResult> ListNotes([FromQuery] ListNotesQuery query)
 {
     try
     {
         return(Ok(await _mediator.Send(query)));
     }
     catch
     {
         return(BadRequest());
     }
 }