Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

更新user的角色,代码里是Add角色. #35

Closed
yufeiyunsui opened this issue Dec 2, 2019 · 0 comments
Closed

更新user的角色,代码里是Add角色. #35

yufeiyunsui opened this issue Dec 2, 2019 · 0 comments
Labels
BUG Something isn't working 已完成

Comments

@yufeiyunsui
Copy link

` ///


/// 更新用户与角色
///

///
///
// PUT: api/User/5
[HttpPut]
public async Task<MessageModel> Put([FromBody] sysUserInfo sysUserInfo)
{
// 这里也要做后期处理,会有用户个人中心的业务

        var data = new MessageModel<string>();
        if (sysUserInfo != null && sysUserInfo.uID > 0)
        {
            if (sysUserInfo.RID > 0)
            {
                var usrerole = await _userRoleServices.Query(d => d.UserId == sysUserInfo.uID && d.RoleId == sysUserInfo.RID);
                if (usrerole.Count == 0)
                {
                    await _userRoleServices.Add(new UserRole(sysUserInfo.uID, sysUserInfo.RID));
                }
            }

            data.success = await _sysUserInfoServices.Update(sysUserInfo);
            if (data.success)
            {
                data.msg = "更新成功";
                data.response = sysUserInfo?.uID.ObjToString();
            }
        }

        return data;
    }`
anjoy8 added a commit that referenced this issue Dec 2, 2019
1、一个用户可以拥有多个角色权限;
2、修复 Bug  #35
@anjoy8 anjoy8 added 已完成 BUG Something isn't working labels Dec 2, 2019
@anjoy8 anjoy8 closed this as completed Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Something isn't working 已完成
Projects
None yet
Development

No branches or pull requests

2 participants