Exemple #1
0
        /// <summary>
        /// 获取文章列表
        /// </summary>
        /// <returns></returns>

        public IActionResult wenzhanglist()
        {
            userinfo uif = new userinfo();

            uif.username = HttpContext.Request.Cookies["user"];
            uif.pwd      = HttpContext.Request.Cookies["key"];
            WenZhangBLL uib  = new WenZhangBLL();
            var         data = uib.Getuserinfo(uif);
            List <userwenzhangkuozhan> wenzhangleixinglist = new List <userwenzhangkuozhan>();

            if (data.Rows.Count == 1)
            {
                string leixing    = GetKeyValue("leixing");
                string keyword    = GetKeyValue("keyword");
                string qpagestart = GetKeyValue("page");
                ViewData["nowpage"] = 1;
                string qpagecount = GetKeyValue("pagecount");
                int    pagestart  = 0;
                int    pagecount  = 20;
                if (!string.IsNullOrEmpty(qpagestart) && !string.IsNullOrEmpty(qpagecount))
                {
                    pagestart           = Convert.ToInt32(qpagestart);
                    pagecount           = Convert.ToInt32(qpagecount);
                    ViewData["nowpage"] = pagestart + 1;
                }
                if (string.IsNullOrEmpty(leixing) || leixing == "-1")
                {
                    ViewData["leixing"] = "-1";
                    wenzhangleixinglist = uib.Getuserwenzhanglist(data.Rows[0]["id"].ToString(), leixing = "-1", keyword, pagestart, pagecount);
                }
                else
                {
                    ViewData["leixing"] = leixing;
                    wenzhangleixinglist = uib.Getuserwenzhanglist(data.Rows[0]["id"].ToString(), leixing, keyword, pagestart, pagecount);
                }
                ViewData["dat"] = wenzhangleixinglist;
                return(View());
            }
            else
            {
                wenzhangleixinglist.Add(new userwenzhangkuozhan()
                {
                    count = 0, toal = 0
                });
                ViewData["dat"] = wenzhangleixinglist;
                return(View());
            }
        }
        /// <summary>
        /// 获取文章列表
        /// </summary>
        /// <returns></returns>

        public JsonResult wenzhanglist()
        {
            WenZhangBLL uib      = new WenZhangBLL();
            UserInfoBLL uifbll   = new UserInfoBLL();
            string      userName = GetKeyValue("username");
            var         userInfo = uifbll.GetThisUserNameInfo(userName);
            Result <List <userwenzhangkuozhan> > result = new Result <List <userwenzhangkuozhan> >();
            List <userwenzhangkuozhan>           wenzhangleixinglist = new List <userwenzhangkuozhan>();

            if (userInfo != null)
            {
                string leixing    = GetKeyValue("leixing");
                string keyword    = GetKeyValue("keyword");
                string qpagestart = GetKeyValue("page");
                //ViewData["nowpage"] = 1;
                string qpagecount = GetKeyValue("pagecount");
                int    pagestart  = 0;
                int    pagecount  = 20;
                if (!string.IsNullOrEmpty(qpagestart) && !string.IsNullOrEmpty(qpagecount))
                {
                    pagestart = Convert.ToInt32(qpagestart);
                    pagecount = Convert.ToInt32(qpagecount);
                    //ViewData["nowpage"] = pagestart + 1;
                }
                if (string.IsNullOrEmpty(leixing) || leixing == "-1")
                {
                    //ViewData["leixing"] = "-1";
                    wenzhangleixinglist = uib.Getuserwenzhanglist(userInfo.id.ToString(), leixing = "-1", keyword, pagestart, pagecount);
                }
                else
                {
                    //ViewData["leixing"] = leixing;
                    wenzhangleixinglist = uib.Getuserwenzhanglist(userInfo.id.ToString(), leixing, keyword, pagestart, pagecount);
                }
                result.content = wenzhangleixinglist;
                result.count   = wenzhangleixinglist.Count;
                result.issuf   = true;
                result.msg     = "";
            }
            else
            {
                result.count = 0;
                result.issuf = false;
                result.msg   = "用户不存在";
            }
            return(Json(result));
        }