public async Task <IActionResult> CreateUser(MUserDto createUserDto) { var userModel = _mapper.Map <MUser>(createUserDto); userModel.Subject = Guid.NewGuid().ToString(); await _localUserService.AddUserAsync(userModel); return(Ok()); }
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)); }
public async Task <IActionResult> UpdateUser(MUserDto updateUserDto) { await UsersService.UpdateUserAsync(updateUserDto); return(Ok()); }