public IActionResult CurrentUser(string userName, string categoryName) { if (HttpContext.Request.Cookies.ContainsKey("userName") && HttpContext.Request.Cookies["userName"] != userName) { Response.Cookies.Delete("userName"); } Response.Cookies.Append("userName", userName, new Microsoft.AspNetCore.Http.CookieOptions() { Expires = DateTime.Now.AddYears(1) }); var rootConfig = _uiConfigurationService.GetConfiguration(userName); ViewData["Title"] = userName; var controlModels = new List <IControlModel>(); var currentCategory = rootConfig.Categories.FirstOrDefault(cat => cat.Name == categoryName) ?? rootConfig.Categories.First(); foreach (var controlModel in currentCategory.ControlModels) { var model = _controlModelService.Convert(controlModel); if (model != null) { controlModels.Add(model); } } ViewData["Notifications"] = _notificationService.GetSystemNotifications(); ViewData["CategoryName"] = currentCategory.Name; ViewData["Controls"] = controlModels; ViewData["UiCategories"] = rootConfig.Categories ?? Array.Empty <UiConfigurationCategory>(); ViewData["UiConfigRoot"] = rootConfig; return(View()); }