Пример #1
0
        //
        // GET: /Platform/SysArea/

        public ActionResult Index(string keyword, string ordering, int pageIndex = 1, bool search = false)
        {
            var model =
                _SysAreaService.GetAll()
                .Select(
                    a =>
                    new
            {
                a.Name,
                a.AreaName,
                a.SystemId,
                a.Enable,
                a.Id
            }).Search(keyword);

            if (search)
            {
                model = model.Search(Request.QueryString);
            }
            if (!string.IsNullOrEmpty(ordering))
            {
                model = model.OrderBy(ordering, null);
            }

            return(View(model.ToPagedList(pageIndex)));
        }
        //
        // GET: /Platform/SysController/Edit/5

        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Edit(string id)
        {
            var item = new SysController();

            if (!string.IsNullOrEmpty(id))
            {
                item = _sysControllerService.GetById(id);
            }
            ViewBag.SysAreaId    = new SelectList(_sysAreaService.GetAll(), "Id", "Name", item.SysAreaId);
            ViewBag.SysActionsId = new MultiSelectList(_sysActionService.GetAll(), "Id", "Name",
                                                       item.SysControllerSysActions?.Select(a => a.SysActionId));
            return(View(item));
        }