Exemplo n.º 1
0
        public IActionResult GetInvoicesBySalesRepId(int salesRepId)

        {
            var employee = _userRepository.GetEmployeeById(salesRepId);

            if (employee == null)
            {
                return(NotFound("No Employees Match This Sales Rep Id"));
            }
            var invoicesBySalesRep   = _repository.GetInvoicesBySalesRepId(salesRepId);
            var noInvoicesBySalesRep = !invoicesBySalesRep.Any();

            if (noInvoicesBySalesRep)
            {
                return(NotFound("There are currently no invoices for this sales rep."));
            }
            return(Ok(invoicesBySalesRep));
        }