public async Task <ActionResult <IEnumerable <Agency> > > GetByCodeAsync( [FromServices] IAgencyRepository repository, [FromRoute] string code ) { var agency = await repository.GetByCode(code); if (agency == null) { return(NotFound()); } return(Ok(agency)); }