public bool IsCountryEmbargoed(SearchCountryBlacklistRequest model) { Establish.For(model, nameof(model)).IsNotNull() .Property(x => x.CountryCode, nameof(model.CountryCode), e => e.IsNotNullOrEmpty().HasExactLength(2)); return(CSDenialService.IsCountryEmbargoed(model.CountryCode)); }
public IActionResult SearchCountry([HttpTrigger(AuthorizationLevel.Function, "post", Route = "search/country")] SearchCountryBlacklistRequest model, ILogger logger) { try { var isCountryEmbargoed = BlacklistManager.IsCountryEmbargoed(model); var result = new { IsEmbargoed = isCountryEmbargoed }; return(new OkObjectResult(result)); } catch (Exception ex) { return(new BadRequestObjectResult(new ExceptionResult(ex))); } }