public IEnumerable <InvoiceServiceResponse> GetInvoices(InvoiceCollectionServiceRequest request) { request.UpperTotal = request.UpperTotal == 0 ? decimal.MaxValue : request.UpperTotal; var entities = _context.Invoices .Where(i => request.CompanyId == Guid.Empty || i.CompanyId == request.CompanyId) .Where(i => request.InvoiceType == InvoiceType.None || i.InvoiceType == (i.InvoiceType & request.InvoiceType)) .Where(i => i.TotalValue >= request.LowerTotal && i.TotalValue <= request.UpperTotal) .Where(i => i.TotalValue >= request.LowerTotal && i.TotalValue <= request.UpperTotal); return(AutoMapperConfig.Map <IEnumerable <Invoice>, IEnumerable <InvoiceServiceResponse> >(entities)); }
public ActionResult <InvoiceServiceResponse> GetInvoices([FromHeader] InvoiceCollectionServiceRequest request) => Ok(_invoiceManager.GetInvoices(request));