public async Task <AbstractAnswer <IEnumerable <Bill> > > Handle(GetBillsCommand request, CancellationToken cancellationToken) { try { var founded = await context.Bills .Where(x => x.UserId == request.UserId) .Include(x => x.User) .Select(x => mapper.Map <BillDB, Bill>(x)) .ToListAsync(cancellationToken); return(CreateSuccess(founded)); } catch { return(CreateFailed(new[] { "Database error" })); } }
public async Task <AbstractAnswer <IEnumerable <Bill> > > GetBillsAsync(GetBillsCommand command) { return(await mediator.Send(command)); }