public async Task <ActionResult <IQueryable <GalleryModel> > > GetGalleriesAsync() { var query = new GetAllGalleriesQuery(); var result = await _mediator.Send(query); return(Ok(result)); }
public async Task <IQueryable <GalleryModel> > Handle(GetAllGalleriesQuery request, CancellationToken cancellationToken) { try { var result = Context.Galleries.ProjectTo <GalleryModel>(Mapper.ConfigurationProvider); return(await Task.FromResult(result)); } catch (System.Exception exeption) { throw new BadRequestException(exeption.Message); } }