Exemplo n.º 1
0
        public async Task <ResponseResult <int> > Add_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 menus     = requestParamterHelper.GetParamValue("menuId");

            var role = new AdminRole();

            role.Name = roleName;

            var serviceResult = await _roleService.AddRoleAsync(role, menus.Select(m => int.Parse(m)).ToList());

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