public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "referencedata/standard-sector-codes/{standardSectorCodeId}")] HttpRequest req, ILogger log, [Inject] IStandardSectorCodeService standardSectorCodeService, int standardSectorCodeId) { try { var results = await standardSectorCodeService.GetByStandardSectorCodeIdAsync(standardSectorCodeId); if (results == null) { new NotFoundResult(); } return(new JsonResult(results, new JsonSerializerSettings { ContractResolver = new DefaultContractResolver() })); } catch (Exception e) { log.LogError(e, e.Message); return(new StatusCodeResult(StatusCodes.Status500InternalServerError)); } }
public StandardsPopulationService( ISearchServiceClient searchServiceClient, IPopulationConfiguration populationConfiguration, ILarsContextFactory contextFactory, IStandardSectorCodeService standardSectorCodeService, ICommonComponentLookupService commonComponentLookupService, IComponentTypeService componentTypeService, ICommonComponentService commonComponentService, IRelatedLearningAimsService relatedLearningAimsService) : base(searchServiceClient, populationConfiguration) { _contextFactory = contextFactory; _standardSectorCodeService = standardSectorCodeService; _commonComponentLookupService = commonComponentLookupService; _componentTypeService = componentTypeService; _commonComponentService = commonComponentService; _relatedLearningAimsService = relatedLearningAimsService; }