예제 #1
0
        public ActionResult Form(int id = 0)
        {
            ArticleDto        theData = new ArticleDto();
            List <Attachment> alist   = new List <Attachment>();
            List <Tag>        tagList = new List <Tag>();

            if (id > 0)

            {
                Article article = _articleBusiness.GetEntity(id);
                if (article != null)
                {
                    theData = _mapper.Map <Article, ArticleDto>(article);//进行Dto对象与模型之间的映射
                    alist   = _attachmentBusiness.GetIQueryableList(m => m.TargetId == article.Id).CastToList <Attachment>();
                    tagList = _tagBusiness.GetIQueryableList(m => m.Id > 0).CastToList <Tag>();
                }
            }
            ViewBag.AttachmentList = alist;
            ViewBag.TagList        = tagList;
            return(View(theData));
        }