/// <summary> /// 创建用户 /// </summary> /// <param name="sysUser"></param> /// <returns></returns> public async Task CreateSysUser(SysUser sysUser) { using (var sysUserDao = new SysUserDao()) { await sysUserDao.CreateAsync(sysUser); } }
/// <summary> /// 用户注册 /// </summary> /// <param name="sysUser"></param> /// <param name="sysRoleIds"></param> /// <returns></returns> public async Task Register(SysUser sysUser, Guid[] sysRoleIds) { using (var userDao = new SysUserDao()) { await userDao.CreateAsync(sysUser); Guid userId = sysUser.Id; if (sysRoleIds != null) { using (var sysUserRoleDao = new SysUserRoleDao()) { foreach (var roleId in sysRoleIds) { await sysUserRoleDao.CreateAsync(new SysUserRole() { SysUserId = userId, SysRoleId = roleId }); } } } } }