コード例 #1
0
 public IViewComponentResult Invoke()
 {
     return(View(
                new Model
     {
         EnableProductImprovement = _applicationConfigurationService.IsProductImprovementEnabled(),
         MeasurementId = _appSettings.GoogleAnalyticsMeasurementId,
         UserId = _adminAppUserContext?.User?.Id
     }));
 }
コード例 #2
0
        public ActionResult Error()
        {
            var exceptionHandlerFeature = HttpContext.Features.Get <IExceptionHandlerPathFeature>();
            var exception = exceptionHandlerFeature?.Error ?? new Exception();

            _logger.Error(exception);

            var errorModel = new ErrorModel(exception,
                                            _applicationConfigurationService.IsProductImprovementEnabled() && HttpContext.User.Identity.IsAuthenticated);

            return(HttpContext.Request.IsAjaxRequest()
                ? (ActionResult)PartialView("_ErrorFeedback", errorModel)
                : View(errorModel));
        }
コード例 #3
0
        public async Task OnActionExecutionAsync(ActionExecutingContext filterContext, ActionExecutionDelegate next)
        {
            if (_applicationConfigurationService.IsProductImprovementEnabled() && !string.IsNullOrEmpty(_appSettings.GoogleAnalyticsMeasurementId))
            {
                try
                {
                    if (_type == TelemetryType.Event)
                    {
                        await _telemetry.Event(_action);
                    }
                    else
                    {
                        await _telemetry.View(_action);
                    }
                }
                catch (Exception e)
                {
                    _logger.Error("Google Analytics Add Telemetry Filter failed", e);
                }
            }

            await next();
        }