public async Task UpdateNames(Guid userId, UpdateUserNamesDto dto) { var model = await _userProfileRepository.Get(userId); model.UpdateNames(dto.NickName, dto.FirstName, dto.LastName); await _userProfileRepository.Update(model); }
public async Task <string> UpdateNames(Guid userId, UserViewModel model) { if (string.IsNullOrEmpty(model.NickName)) { return("Nickname can not be empty!"); } if (model.NickName != "-") { //check if nickname exist _apiClient.SetPrincipal(_httpContextAccessor.HttpContext.User); var user = await _apiClient.GetUserByNickName(model.NickName); if (user != null && user.Id != userId) { return("NickName alrleady exist"); } } var dto = new UpdateUserNamesDto { NickName = model.NickName, FirstName = model.FirstName, LastName = model.LastName }; await _apiClient.UpdateUserNames(userId, dto); return(string.Empty); }
public async Task UpdateUserNames(Guid userId, UpdateUserNamesDto dto) { await Patch($"{ProfileUrlPrefix}/{userId}/names", dto); }
public async Task <IActionResult> UpdateNames(Guid userId, [FromBody] UpdateUserNamesDto dto) { await _profileService.UpdateNames(userId, dto); return(Ok()); }