예제 #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
        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());
        }