/// <summary>
 /// 修改栏目
 /// </summary>
 /// <param name="c"></param>
 /// <returns></returns>
 public int UpdateClass(normal_classContract c)
 {
     return ClassDao.UpdateClass(c.ToPO<normal_class>());
 }
        public ActionResult AddClass(normal_classContract ClassC, FormCollection fc)
        {
            string ccid = Request.QueryString["ccid"];
            ViewData["ccid"] = ccid;
            string operateType = Request.QueryString["operateType"];
            #region List
            //在“当前页位置”导航显示
            var IsTop = new string[] { "否", "是" };
            var IsTopList = new List<object> { };
            for (int i = 0; i < IsTop.Length; i++)
            {
                var item = new { text = IsTop[i], value = i };
                IsTopList.Add(item);
            }
            ViewData["IsTop"] = new SelectList(IsTopList, "value", "text");
            #endregion
            int eid = (Session["user"] as UsersContract).EId;
            normal_channelContract channel = ChannelBll.GetChannelContractByidAndEid(eid, int.Parse(ccid));
            //栏目模版页
            ViewData["ClassTemp"] = new SelectList(TBll.getTemplateByList(eid, channel.Type, "class"), "Id", "Title"); ;
            //内容模版页
            ViewData["ContentTemp"] = new SelectList(TBll.getTemplateByList(eid, channel.Type, "content"), "Id", "Title");
            if (ModelState.IsValid)
            {
                ClassC.Info = "";
                ClassC.Keywords = "";
                ClassC.Img = "";
                ClassC.Content = "";
                ClassC.Folder = "";
                ClassC.Code = "";
                ClassC.FilePath = "";
                ClassC.FirstPage = "";
                ClassC.AliasPage = "";
                ClassC.ChannelId = int.Parse(ccid);
                switch (operateType)
                {
                    case "add":
                        if (ClassBll.InsertClass(ClassC) > 0)
                        {
                            // Success
                            ViewData["msg"] = "添加成功!";
                            ViewData["url"] = Url.Action("ClassList", new { ccid = ccid });
                            return View("Success");
                        }
                        else
                        {
                            return View(ClassC);
                        }

                    default:
                        //Edit
                        if (ClassBll.UpdateClass(ClassC) > 0)
                        {
                            // Success
                            ViewData["msg"] = "修改成功!";
                            ViewData["url"] = Url.Action("ClassList", new { ccid = ccid });
                            return View("Success");
                        }
                        else
                        {
                            return View(ClassC);
                        }
                }
            }
            else
            {
                return View(ClassC);
            }
        }
 /// <summary>
 /// 添加栏目
 /// </summary>
 /// <param name="c"></param>
 /// <returns></returns>
 public int InsertClass(normal_classContract c)
 {
     return ClassDao.InsertClass(c.ToPO<normal_class>());
 }
 public ActionResult AddClass(int id)
 {
     string ccid = Request.QueryString["ccid"];
     ViewData["ccid"] = ccid;
     string operateType = Request.QueryString["operateType"];
     normal_classContract classC = new normal_classContract();
     #region List
     //在“当前页位置”导航显示
     var IsTop = new string[] { "否", "是" };
     var IsTopList = new List<object> { };
     for (int i = 0; i < IsTop.Length; i++)
     {
         var item = new { text = IsTop[i], value = i };
         IsTopList.Add(item);
     }
     ViewData["IsTop"] = new SelectList(IsTopList, "value", "text");
     #endregion
     //查询ccid 频道的信息
     int eid = (Session["user"] as UsersContract).EId;
     normal_channelContract channel = ChannelBll.GetChannelContractByidAndEid(eid, int.Parse(ccid));
     //栏目模版页
     ViewData["ClassTemp"] = new SelectList(TBll.getTemplateByList(eid, channel.Type, "class"), "Id", "Title");
     //内容模版页
     ViewData["ContentTemp"] = new SelectList(TBll.getTemplateByList(eid, channel.Type, "content"), "Id", "Title");
     switch (operateType)
     {
         case "add":
             ViewBag.pTitle = "添加栏目";
             classC.PageSize = 5;
             break;
         default:
             ViewBag.pTitle = "修改栏目";
             if (id != 0)
             {
                 //查询
                 classC = ClassBll.GetClassByIdAndEid(id, (Session["user"] as UsersContract).EId);
             }
             else
             {
                 ViewBag.pTitle = "添加栏目";
             }
             break;
     }
     return View(classC);
 }