コード例 #1
0
        public async Task <IActionResult> CreateUser(MUserDto createUserDto)
        {
            var userModel = _mapper.Map <MUser>(createUserDto);

            userModel.Subject = Guid.NewGuid().ToString();

            await _localUserService.AddUserAsync(userModel);

            return(Ok());
        }
コード例 #2
0
ファイル: UsersService.cs プロジェクト: windischb/middlerApp
        public async Task UpdateUserAsync(MUserDto userDto)
        {
            var userInDB = await GetUserAsync(userDto.Id);

            _mapper.Map(userDto, userInDB);
            var roleIds        = userDto.Roles.Select(ur => ur.Id).ToList();
            var availableRoles = DbContext.Roles.Where(r => roleIds.Contains(r.Id)).ToList();

            userInDB.Roles = availableRoles;

            await DbContext.SaveChangesAsync();

            EventDispatcher.DispatchUpdatedEvent("IDPUsers", _mapper.Map <MUserDto>(userInDB));
        }
コード例 #3
0
        public async Task <IActionResult> UpdateUser(MUserDto updateUserDto)
        {
            await UsersService.UpdateUserAsync(updateUserDto);

            return(Ok());
        }