public async Task <IActionResult> GetEventCode([FromRoute] Guid?domainId) { IActionResult result = null; try { if (result == null && (!domainId.HasValue || domainId.Value.Equals(Guid.Empty))) { result = BadRequest("Missing domain id parameter value"); } if (result == null) { using ILifetimeScope scope = _container.BeginLifetimeScope(); SettingsFactory settingsFactory = scope.Resolve <SettingsFactory>(); if (!(await VerifyDomainAccount(domainId.Value, settingsFactory, _settings.Value, scope.Resolve <IDomainService>()))) { result = StatusCode(StatusCodes.Status401Unauthorized); } else { CoreSettings settings = settingsFactory.CreateCore(_settings.Value); IMetricFactory metricFactory = scope.Resolve <IMetricFactory>(); result = Ok( await metricFactory.GetEventCodes(settings, domainId.Value) ); } } } catch (Exception ex) { using (ILifetimeScope scope = _container.BeginLifetimeScope()) { await LogException(ex, scope.Resolve <IExceptionService>(), scope.Resolve <SettingsFactory>(), _settings.Value); } result = StatusCode(StatusCodes.Status500InternalServerError); } return(result); }