public async Task <ActionResult <List <string> > > GetCongregationsAsync(CongregationsRequest request) { var validRequest = RequestUtilites.ValidateCongregationsRequest(_taxOfficeClient, request); var congregations = await _taxOfficeClient.GetAllCongregations(validRequest.Result.IncomeYear, validRequest.Result.Municipality); return(congregations); }
private static async Task <string> ValidateCongregation(ITaxAgencyClient _taxOfficeClient, string congregation, int incomeYear, string municipality) { var congregations = (await _taxOfficeClient.GetAllCongregations(incomeYear, municipality)); if (!congregations.Contains(congregation)) { throw new ApiException("Municipality not found", HttpStatusCode.NotFound); } return(congregation); }