示例#1
0
        public ActionResult Edit(int?id)
        {
            var userinfo = BLLSession.UserInfoSessioin;
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("blogTag", GetDataHelper.GetAllTag(BLLSession.UserInfoSessioin.Id).ToList());
            dic.Add("blogType", CacheData.GetAllType().Where(t => t.UsersId == BLLSession.UserInfoSessioin.Id).ToList());
            List <BlogsDTO> blogs = new List <BlogsDTO>();

            if (null != id)
            {
                int          ttt;
                BLL.BlogsBLL blogbll = new BlogsBLL();
                if (id == 0)//代表 未分类
                {
                    blogs = blogbll.GetList(1, 50, out ttt, t => t.BlogTypes.Count() == 0 && (t.UsersId == userinfo.Id), false, t => t.BlogCreateTime, false)
                            .ToList().Select(t => new BlogsDTO()
                    {
                        Id        = t.Id,
                        BlogTitle = t.BlogTitle
                    }).ToList();
                }
                else
                {
                    blogs = blogbll.GetList(1, 50, out ttt, t => t.BlogTypes.Where(v => v.Id == id).Count() > 0 && (t.UsersId == userinfo.Id), false, t => t.BlogCreateTime, false)
                            .ToList().Select(t => new BlogsDTO()
                    {
                        Id        = t.Id,
                        BlogTitle = t.BlogTitle
                    }).ToList();
                }
            }
            dic.Add("blogs", blogs);
            return(View(dic));
        }
示例#2
0
        public ActionResult Release(int?id)
        {
            if (BLLSession.UserInfoSessioin == null)
            {
                Response.Redirect("/Account/Login?href=/ManageBlog/Release");
                return(null);
            }
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("blogTag", GetDataHelper.GetAllTag(BLLSession.UserInfoSessioin.UserId).ToList());
            dic.Add("blogType", DataCache.GetAllType().Where(t => t.UserId == BLLSession.UserInfoSessioin.UserId).ToList());
            Blogs blog = null;

            if (null != id)
            {
                blog = new Blogs();
                BlogsBLL blogbll = new BlogsBLL();
                blog = blogbll.GetList(t => t.BlogId == id && (t.UserId == BLLSession.UserInfoSessioin.UserId || BLLSession.UserInfoSessioin.UserName == admin)).FirstOrDefault();
                if (blog == null)
                {
                    return(View("Error"));
                }
            }
            dic.Add("blog", blog);
            return(View(dic));
        }
示例#3
0
        /// <summary>
        /// 获取用户下的所有标签和文章分类
        /// </summary>
        /// <returns></returns>
        public UserTagTypesOutput GetUserTagTypes()
        {
            UserTagTypesOutput userTagTypes = new UserTagTypesOutput();

            userTagTypes.BlogTags  = GetDataHelper.GetAllTag(BLLSession.UserInfoSessioin.Id).ToList();
            userTagTypes.BlogTypeS = GetDataHelper.GetAllType(BLLSession.UserInfoSessioin.Id).ToList();
            return(userTagTypes);
        }
示例#4
0
        /// <summary>
        /// 公共数据存储(从数据缓存中取 如何以后数据量大的话 再考虑是否实时查询)
        /// </summary>
        /// <param name="dic"></param>
        /// <param name="name"></param>
        private void SetDic(Dictionary <string, object> dic, string name)
        {
            var user = GetDataHelper.GetAllUser().FirstOrDefault(t => t.UserName == name);

            //dic.Add("blogName", name);
            dic.Add(Constant.blogUser, user);
            dic.Add(Constant.userBlogTag, GetDataHelper.GetAllTag(user.Id).ToList());
            dic.Add(Constant.userBlogType, GetDataHelper.GetAllType().Where(t => t.BlogUser.Id == user.Id).ToList());
            dic.Add(Constant.SessionUser, BLL.Common.BLLSession.UserInfoSessioin);
        }
示例#5
0
        public ActionResult Release(int?id)
        {
            var userinfo = BLLSession.UserInfoSessioin;

            if (null == userinfo)
            {
                Response.Redirect("/UserManage/Login?href=/Admin/Release");
                return(null);
            }
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("blogTag", GetDataHelper.GetAllTag(BLLSession.UserInfoSessioin.Id).ToList());
            dic.Add("blogType", CacheData.GetAllType().Where(t => t.UsersId == BLLSession.UserInfoSessioin.Id).ToList());
            ModelDB.Blogs blog = new ModelDB.Blogs();
            if (null != id)
            {
                BLL.BlogsBLL blogbll = new BlogsBLL();
                blog = blogbll.GetList(t => t.Id == id && (t.UsersId == userinfo.Id || userinfo.UserName == admin)).FirstOrDefault();
            }
            dic.Add("blog", blog);
            return(View(dic));
        }