コード例 #1
0
        public void ListShow()
        {
            int id = Convert.ToInt32(Request["id"]);

            Model.ContentList ContentList = contentListBLL.GetEntity(c => c.Id == id);
            ContentList.IsShow = Request["isShow"].ToString() == "True";
            bool IsShowEdit = contentListBLL.Modify(ContentList);

            Response.Write(IsShowEdit.ToString());
        }
コード例 #2
0
        public void EditContent()
        {
            bool IsShowEdit = false;
            int  id         = Convert.ToInt32(Request["id"]);

            Model.ContentList ContentList = new Model.ContentList();
            ContentList = contentListBLL.GetEntity(c => c.Id == id);
            if (!string.IsNullOrEmpty(Request["ImgBase"]))
            {
                string ImgBase = Request["ImgBase"].ToString();
                ImgBase = ImgBase.Substring(ImgBase.IndexOf("base64,") + 7);
                if (ContentList == null)
                {
                    BaseInImg(ImgBase, Request["ImgName"].ToString());
                }
                else if (Request["ImgName"].ToString() != ContentList.Img)
                {
                    BaseInImg(ImgBase, Request["ImgName"].ToString());
                }
            }

            if (ContentList != null)
            {
                ContentList.Img      = string.IsNullOrEmpty(Request.Form["ImgName"]) ? ContentList.Img : Request["ImgName"].ToString();
                ContentList.Label    = string.IsNullOrEmpty(Request.Form["Label"]) ? ContentList.Label : Request["Label"].ToString();
                ContentList.Title    = string.IsNullOrEmpty(Request.Form["Title"]) ? ContentList.Title : Request["Title"].ToString();
                ContentList.Content  = string.IsNullOrEmpty(Request.Form["Content"]) ? ContentList.Content : Request["Content"].ToString();
                ContentList.IsShow   = string.IsNullOrEmpty(Request.Form["isShow"]) ? ContentList.IsShow : Request["isShow"].ToString() == "True";
                ContentList.Author   = string.IsNullOrEmpty(Request.Form["Author"]) ? ContentList.Author : Request["Author"].ToString();
                ContentList.LastTime = DateTime.Now;
                IsShowEdit           = contentListBLL.Modify(ContentList);
            }
            else
            {
                ContentList = new Model.ContentList
                {
                    Label   = string.IsNullOrEmpty(Request["Label"]) ? ContentList.Label : Request["Label"].ToString(),
                    Title   = string.IsNullOrEmpty(Request["Title"]) ? ContentList.Title : Request["Title"].ToString(),
                    Content = string.IsNullOrEmpty(Request["Content"]) ? ContentList.Content : Request["Content"].ToString(),
                    IsShow  = string.IsNullOrEmpty(Request["isShow"]) ? ContentList.IsShow : Request["isShow"].ToString() == "True",
                    Author  = string.IsNullOrEmpty(Request["Author"]) ? ContentList.Content : Request["Author"].ToString(),
                    Img     = string.IsNullOrEmpty(Request["ImgName"]) ? ContentList.Img : Request["ImgName"].ToString(),
                    Time    = DateTime.Now
                };
                IsShowEdit = contentListBLL.Add(ContentList);
            }
            Response.Write(IsShowEdit.ToString());
        }