示例#1
0
 public JsonResult update(Entity.DetailChannelInfo info, string icon, int adminmenuid = 0)
 {
     using (var manage = new Data.CMSManage())
     {
         //更新操作
         manage.updateDetailChannel(info, adminmenuid, icon);
         return(getResult(manage.Error, manage.Message));
     }
 }
        /// <summary>
        /// 更新内容频道
        /// </summary>
        /// <param name="info"></param>
        public bool updateDetailChannel(Entity.DetailChannelInfo info, int adminmenuid, string icon)
        {
            var channelInfo = this.getDetailChannelInfo(info.ChannelCode);

            if (channelInfo == null)
            {
                this.dbContext.DetailChannel.Add(info);

                if (adminmenuid > 0)
                {
                    var keylist = this.getDictionaryKeyList("detailchannel");
                    if (keylist.Count > 0)
                    {
                        var fatherKeyInfo = new Entity.AdminMenuInfo()
                        {
                            MenuName = info.ChannelName,
                            RoleType = "admin",
                            Display  = 1,
                            OrderNo  = 200,
                            FatherId = adminmenuid,
                            Explain  = info.ChannelName,
                            Icon     = icon
                        };

                        this.updateAdminMenu(fatherKeyInfo);

                        foreach (var keyInfo in keylist)
                        {
                            this.updateAdminMenu(new Entity.AdminMenuInfo()
                            {
                                MenuName   = keyInfo.Title,
                                Area       = keyInfo.Value2,
                                Controller = keyInfo.Value3,
                                Parm       = "channel=" + info.ChannelCode,
                                RoleType   = "admin",
                                Display    = 1,
                                OrderNo    = 200,
                                FatherId   = fatherKeyInfo.AdminMenuId,
                                Explain    = keyInfo.Explain,
                                Icon       = keyInfo.Value4,
                            });
                        }
                    }
                }
            }
            else
            {
                this.dbContext.Entry <Entity.DetailChannelInfo>(channelInfo).CurrentValues.SetValues(info);
            }
            return(this.dbContext.SaveChanges() > 0);
        }
示例#3
0
 //
 // GET: /Admin/Review/
 public ActionResult Index(string channel)
 {
     using (var manage = new Data.CMSManage())
     {
         Entity.DetailChannelInfo channelInfo = null;
         if (!string.IsNullOrEmpty(channel))
         {
             channelInfo = manage.getDetailChannelInfo(channel);
         }
         if (channelInfo != null)
         {
             ViewBag.channel = channelInfo;
             return(View());
         }
         else
         {
             ViewBag.Title   = "该内容频道不存在";
             ViewBag.Message = "缺少参数,该内容频道不存在";
             return(this.Content(this.getSystemTemplate("error.cshtml")));
         }
     }
 }