public ApiResult <List <CultureModel> > GetCultures() { _logger.LogTrace($"getCultures userId={_userId}"); var cultures = _cultureService.GetCultures(_siteId); return(ApiResult <List <CultureModel> > .Success(cultures)); }
protected override void OnActionExecuted(ActionExecutedContext filterContext) { if (filterContext.Result is ViewResult) { var cultures = cultureService.GetCultures(); if (filterContext.Controller.ViewData.Model == null) { filterContext.Controller.ViewData.Model = new BaseViewModel(); } var baseViewModel = (BaseViewModel)filterContext.Controller.ViewData.Model; baseViewModel.Cultures = cultures.Select(c => new BaseCulture { ID = c.ID, Name = c.Name }).ToArray(); } }