public Task <List <BillDto> > Handle(GetBillsRequest request, CancellationToken cancellationToken)
        {
            var bills = _splitThatBillContext.Bills
                        .Include(i => i.BillItems)
                        .Include(i => i.Participants)
                        .ThenInclude(i => i.Person)
                        .Where(w => w.BillTakerId == _contextData.CurrentUser.Id)
                        .ToList();

            return(Task.FromResult(bills.Select(item => _mapper.Map <BillDto>(item)).ToList()));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> GetAllPaid([FromQuery] GetBillsRequest request)
        {
            try
            {
                var paidBills = await billService.GetAllPaidAsync();

                var response = new GetBillsResponse
                {
                    Items = mapper.Map <List <BillDto> >(paidBills),
                    Total = paidBills.Count
                };

                return(Ok(response));
            }
            catch (Exception e)
            {
                return(ExceptionResult(e));
            }
        }