示例#1
0
        /// <summary>
        /// Performs one "Select * from MyTable where MyColumn=MyFilter".
        /// </summary>
        /// <returns>List of found records.</returns>
        public virtual List <TagInfo> GetAll(List <DataFilterExpressionDB> filterExpression)
        {
            motor.OpenConnection();
            List <TagInfo> list = TagDAO.GetAll(filterExpression);

            if (this.closeConnectionWhenFinish)
            {
                motor.CloseConnection();
            }
            return(list);
        }
        public ActionResult Create()
        {
            //Remove preview post
            Session["PreviewPost"] = null;

            var postCategories = db.PostCategories.ToList();
            //postcategories selectlist
            var postCategoriesSelectList = new MySelectList()
            {
                FormElementName = "CategoryId"
            };

            foreach (var item in postCategories)
            {
                postCategoriesSelectList.Items.Add(new MySelectListItem()
                {
                    Id   = item.Id.ToString(),
                    Name = item.Name
                });
            }

            var tags = tagDAO.GetAll();
            //tags selectlist
            var tagSelectList = new MySelectList()
            {
                FormElementName = "TagIds"
            };

            foreach (var item in tags)
            {
                tagSelectList.Items.Add(new MySelectListItem()
                {
                    Id   = item.Id.ToString(),
                    Name = item.Name
                });
            }

            ViewBag.PostCategories = postCategoriesSelectList;
            ViewBag.Tags           = tagSelectList;
            return(View());
        }