Пример #1
0
        public IActionResult Index()
        {
            var deviceCode = _deviceResolver.Resolve(HttpContext);

            ViewData["DeviceCode"] = deviceCode;

            return(View());
        }
Пример #2
0
        /// <inheritdoc />
        public void PopulateValues(ViewLocationExpanderContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            // viewdivert -> deviceCode
            context.Values[_options.Indicator] =
                _deviceResolver.Resolve(context.ActionContext.HttpContext);
        }
 public string LoadPreference(HttpContext context)
 => _switchers
 .OrderByDescending(t => t.Priority)
 .Select(t => t.LoadPreference(context))
 .FirstOrDefault(t => t != null)?.DeviceCode ?? _deviceResolver.Resolve(context);