public ArticleViewModel PopulateArticleViewModel(int?id)
        {
            var article   = _articleService.Find(id);
            var viewModel = new ArticleViewModel
            {
                ArticleTypes = _articleTypeService.GetAll(),
                Games        = _gameService.GetAll(),
                Authors      = _authorService.GetAll(),
                Article      = article,
                ImageTypes   = _imageTypeService.GetByType(ImageTypes.Article)
            };

            return(viewModel);
        }
Beispiel #2
0
 public override void OnActionExecuting(ActionExecutingContext filterContext)
 {
     _articleTypeService = _articleTypeService ?? new ServiceLocator().GetService <IArticleTypeService>();
     (filterContext.Controller as Controller)
     .ViewData[ViewDataKeys.ArticleCategory] = new SelectList(_articleTypeService.GetAll(), "ID", "Title");
 }