コード例 #1
0
        /// <summary>
        /// 作者页
        /// </summary>
        /// <param name="accountid"></param>
        /// <returns></returns>
        public ActionResult Index(string CollectionId, string accountid)
        {
            if (accountid == null)
            {
                return(Redirect("/"));
            }
            var user = UserInfo.GetUserInfoBySn(accountid);

            if (user == null)
            {
                return(Redirect("/"));
            }

            var collectionlist = Collection.GetCollectionListByOwnerId(accountid);

            if (CollectionId == "0")
            {
                if (collectionlist.Count > 0)
                {
                    CollectionId = collectionlist[0].Sn;
                }
            }

            ViewBag.CollectionId   = CollectionId;
            ViewBag.CollectionList = collectionlist;
            if (collectionlist.Count == 0)
            {
                //如果没有文集,则什么都不显示
                ViewBag.CollectionArticles = new List <Article>();
            }
            else
            {
                //显示第一个或者指定文集
                var CurrentCollectionId = string.IsNullOrEmpty(CollectionId) ? collectionlist[0].Sn : CollectionId;
                ArticleListManager.ArticleQueryFilter aqf = new ArticleListManager.ArticleQueryFilter()
                {
                    collectionid = CurrentCollectionId,
                    isPrivate    = false,
                    statuslist   = new ApproveStatus[] { ApproveStatus.Accept, ApproveStatus.NotNeed }
                };
                if (Session[ConstHelper.Session_USERID] != null && Session[ConstHelper.Session_USERID].ToString().Equals(accountid))
                {
                    //自己看自己
                    aqf.isPrivate  = null;
                    aqf.statuslist = null;
                }
                var ArticleList = ArticleListManager.GetArticleItemBodyListByArticleList(ArticleListManager.GetArticles(aqf));
                ViewBag.CollectionArticles = ArticleList;
            }
            var userbody = UserManager.GetUserBody(accountid);

            ViewData.Model = userbody;
            ViewBag.Title  = user.NickName;
            ArticleListManager.ArticleQueryFilter publicAQF = new ArticleListManager.ArticleQueryFilter()
            {
                ownid      = accountid,
                isPrivate  = false,
                statuslist = new ApproveStatus[] { ApproveStatus.Accept, ApproveStatus.NotNeed }
            };
            var articles    = ArticleListManager.GetArticles(publicAQF);
            var rankContain = TagUtility.Statistics(articles);

            ViewBag.PersonalTagAside   = ASideColumnManager.CreateTagRankAside(rankContain, 10);
            ViewBag.PersonalHobbyAside = ASideColumnManager.TagHobby(accountid, 10);
            ViewBag.RankTagDic         = rankContain.RankKeyDic;
            return(View());
        }