public async Task <IActionResult> Get([FromQuery] CompanyQueryFilter filters)
        {
            var companies = await _companyService.FindAllAsync(filters);

            var response = new Response(companies);

            return(Ok(response));
        }
예제 #2
0
 public async Task <IEnumerable <Company> > FindAllAsync(CompanyQueryFilter filters)
 {
     return(await _companyRepository.Queryable()
            .WhereFor(!filters.IncludeInactivated, company => !company.Inactivated)
            .WhereFor(filters.Name, company => EF.Functions.Like(company.CorporateName, $"%{filters.Name}%") ||
                      EF.Functions.Like(company.BusinessName, $"%{filters.Name}%"))
            .WhereFor(filters.RegistrationNumber, company => company.RegistrationNumber.Contains(filters.RegistrationNumber))
            .ToListAsync());
 }
        public async Task <IEnumerable <CompanyResponseModel> > FindAllAsync(CompanyQueryFilter filters)
        {
            var companies = await _companyService.FindAllAsync(filters);

            return(_mapper.Map <IEnumerable <CompanyResponseModel> >(companies));
        }