コード例 #1
0
        /// <summary>
        /// 转到修改内容页
        /// </summary>
        /// <returns></returns>
        public async Task <ActionResult> UpdateContent(int id, string ctrl, string columnName)
        {
            var dto = await _contentAppService.GetContent(id);

            ViewBag.ctrl       = ctrl;
            ViewBag.columnName = Server.UrlDecode(columnName);
            ViewBag.action     = "UpdateContent";
            return(View("AddContent", dto));
        }
コード例 #2
0
        /// <summary>
        /// 编辑内容
        /// </summary>
        /// <param name="navId"></param>
        /// <returns></returns>
        public ActionResult EditContentIndex(int navId)
        {
            ViewData["Define"] = _defineAppService.GetDefine();
            var content = _contentAppService.GetContent(navId);

            #region 角色权限处理
            //指定角色
            var             role     = content.RoleListId.Split(',');
            var             roleList = _roleStore.Query.ToList();
            List <RoleTemp> list     = new List <RoleTemp>();
            foreach (var item in roleList)
            {
                RoleTemp temp = new RoleTemp();
                temp.Id   = item.Id;
                temp.Name = item.DisplayName;
                foreach (var r in role)
                {
                    if (r != "")
                    {
                        var rId = Convert.ToInt32(r);
                        if (rId == item.Id)
                        {
                            temp.IsCheck = true;
                        }
                    }
                }
                list.Add(temp);
            }
            content.Role = list;
            //限制角色
            var             roleno     = content.RoleListIdNo.Split(',');
            var             roleListNo = _roleStore.Query.ToList();
            List <RoleTemp> listNo     = new List <RoleTemp>();
            foreach (var item in roleListNo)
            {
                RoleTemp temp = new RoleTemp();
                temp.Id   = item.Id;
                temp.Name = item.DisplayName;
                foreach (var r in roleno)
                {
                    if (r != "")
                    {
                        var rId = Convert.ToInt32(r);
                        if (rId == item.Id)
                        {
                            temp.IsCheck = true;
                        }
                    }
                }

                listNo.Add(temp);
            }
            content.RoleNo = listNo;
            #endregion

            #region 组织权限处理
            //指定组织
            var district                = content.DistrictListId.Split(',');
            var districtList            = _districtAppService.GetAllDistrcit();
            List <DistrictTemp> dislist = new List <DistrictTemp>();
            foreach (var item in districtList)
            {
                DistrictTemp temp = new DistrictTemp();
                temp.Id   = item.Id;
                temp.Name = item.Name;
                foreach (var r in district)
                {
                    if (r != "")
                    {
                        var rId = Convert.ToInt32(r);
                        if (rId == item.Id)
                        {
                            temp.IsCheck = true;
                        }
                    }
                }
                dislist.Add(temp);
            }
            content.District = dislist;
            //限制组织
            var districtno                = content.DistrictListIdNo.Split(',');
            var districtListNo            = _districtAppService.GetAllDistrcit();
            List <DistrictTemp> dislistNo = new List <DistrictTemp>();
            foreach (var item in districtListNo)
            {
                DistrictTemp temp = new DistrictTemp();
                temp.Id   = item.Id;
                temp.Name = item.Name;
                foreach (var r in districtno)
                {
                    if (r != "")
                    {
                        var rId = Convert.ToInt32(r);
                        if (rId == item.Id)
                        {
                            temp.IsCheck = true;
                        }
                    }
                }

                dislistNo.Add(temp);
            }
            content.DistrictNo = dislistNo;
            #endregion
            #region   附件


            #endregion
            //推送模式
            var             push  = _pushwayAppService.GetPushWay();
            List <PushTemp> Plist = new List <PushTemp>();
            foreach (var item in push)
            {
                var      pushId = Convert.ToInt32(item.Id);
                PushTemp p      = new PushTemp();
                p.Id      = item.Id;
                p.Name    = item.Name;
                p.IsCheck = _pushwayAppService.IsPushWay(pushId, content.Id);
                Plist.Add(p);
            }
            content.Push = Plist;

            content.IsEdit = true;
            return(View("Easyman.FwWeb.Views.Content.AddContentIndex", content));
        }