예제 #1
0
        public override void FuncPreInitCreateView()
        {
            //get article types
            var articleTypes = new ArticleTypeModel <ArticleType>().GetData(isBlock: false);

            ViewBag.ArticleTypes = articleTypes.Select(x => new CustomSelectListItem()
            {
                Text = x.ArticleTypeName, Value = x.ArticleTypeID.ToString()
            });
            //get scopes
            var scopes = new ScopeModel <Scope>().GetData(isBlock: false);

            ViewBag.Scopes = scopes.Select(x => new CustomSelectListItem()
            {
                Text = x.ScopeName, Value = x.ScopeID.ToString()
            });
            //get authors
            var authors = new AuthorModel <Author>().GetData(isBlock: false);

            ViewBag.Authors = authors.Select(x => new CustomSelectListItem()
            {
                Text = x.AuthorName, Value = x.AuthorID.ToString()
            });
            base.FuncPreInitCreateView();
        }
예제 #2
0
 public override void FuncPreInitEditView(object id, ref PublishedArticle EditItem, ref PublishedArticleEditModel model)
 {
     if (EditItem == null)
     {
         //get the item by id
         EditItem = new PublishedArticleModel <PublishedArticle>().Get(id);
     }
     if (EditItem != null)
     {
         model          = new PublishedArticleEditModel();
         model.EditItem = EditItem;
         var selectedItem = EditItem;
         var articleTypes = new ArticleTypeModel <ArticleType>().GetData();
         ViewBag.ArticleTypeID = articleTypes.Select(x => new CustomSelectListItem()
         {
             Text = x.ArticleTypeName, Value = x.ArticleTypeID.ToString(), Selected = (x.ArticleTypeID == selectedItem.PublishedArticleID)
         }).OrderBy(x => x.Text).ToList();
     }
 }