Пример #1
0
        public async Task <ResponseResult <int> > Edit_Save()
        {
            //获取参数
            var streamReader = new StreamReader(Request.Body);
            var paramStr     = streamReader.ReadToEnd();
            RequestParamterHelper requestParamterHelper = new RequestParamterHelper(paramStr);

            var roleNames = requestParamterHelper.GetParamValue("roleName");
            var roleName  = roleNames[0];

            var roleIds = requestParamterHelper.GetParamValue("id");
            var roleId  = roleIds[0];

            var menus = requestParamterHelper.GetParamValue("menuId");

            var role = new AdminRole();

            role.Name = roleName;
            role.Id   = int.Parse(roleId);
            var serviceResult = await _roleService.EditRoleAsync(role, menus.Select(m => int.Parse(m)).ToList());

            return(new ResponseResult <int>(true, serviceResult));
        }