コード例 #1
0
ファイル: RoleService.cs プロジェクト: huxuanchenxy/mss5
        public async Task <MSSResult <int> > GetByID(int id)
        {
            MSSResult <int> mRet = new MSSResult <int>();

            try
            {
                if (id == 0)
                {
                    mRet.code = (int)ErrType.ErrParm;
                    mRet.msg  = "参数不正确,id不可为0";
                    return(mRet);
                }
                mRet.relatedData = await _RoleRepo.GetByID(id);

                //List<ActionAll> laa = await _ActionRepo.GetActionAll();
                //List<int> actions = await _ActionRepo.GetActionIDByRoleID(id);
                //mRet.data = ActionHelper.GetCheckedActionTree(laa, actions);
                mRet.data = (await _ActionRepo.GetActionIDByRoleID(id)).ToList();
                mRet.code = (int)ErrType.OK;
                return(mRet);
            }
            catch (Exception ex)
            {
                mRet.code = (int)ErrType.SystemErr;
                mRet.msg  = ex.Message;
                return(mRet);
            }
        }
コード例 #2
0
        public async Task <IActionResult> RoleAsync(long id)
        {
            var role = await _roleRepo.GetByID(id);

            var model = _repo.get(id).data;

            model.RoleName    = role.data.RoleName;
            ViewData["Title"] = $"{model.RoleName} Configuration Role Access";
            return(View(model));
        }
コード例 #3
0
ファイル: RoleController.cs プロジェクト: ekosap/ESimpam
        public async Task <IActionResult> Edit(string id)
        {
            ViewData["Title"] = "Edit Application Role";
            if (!long.TryParse(id.FromBase64(), out long RoleID))
            {
                return(Json(new Metadata()
                {
                    status = false, data = "RoleID not allow"
                }));
            }
            var model = await _repo.GetByID(RoleID);

            return(PartialView("_Edit", model.data));
        }