public IActionResult UpdateUserContact(int userId, [FromBody] UpdateUserContactContract data) { try { m_userManager.UpdateUserContact(userId, data); return(Ok()); } catch (HttpErrorCodeException exception) { return(StatusCode(exception.StatusCode, exception.Message)); } }
public IActionResult UpdateCurrentUserContacts([FromBody] UpdateUserContactContract data) { try { var user = m_authenticationManager.GetCurrentUser(); m_userManager.UpdateUserContact(user.Id, data); return(Ok()); } catch (HttpErrorCodeException exception) { return(StatusCode(exception.StatusCode, exception.Message)); } }
public void UpdateUserContact(int userId, UpdateUserContactContract data) { var userExternalId = GetUserExternalId(userId); var contract = new AuthChangeContactContract { ContactType = m_mapper.Map <ContactTypeEnum>(data.ContactType), UserId = userExternalId, NewContactValue = data.NewContactValue }; var client = m_communicationProvider.GetAuthContactApiClient(); client.ChangeContactAsync(contract).GetAwaiter().GetResult(); }
public void UpdateUserContact(int userId, UpdateUserContactContract data) { try { m_client.Put <object>($"user/{userId}/contact", data); } catch (HttpRequestException e) { if (m_logger.IsErrorEnabled()) { m_logger.LogError("{0} failed with {1}", m_client.GetCurrentMethod(), e); } throw; } }
public async Task <IActionResult> UpdateContact([FromBody] UpdateUserContactContract updateUserContactContract) { if (string.IsNullOrEmpty(updateUserContactContract.NewContactValue)) { return(AjaxErrorResponse(m_localizationService.Translate("EmptyEmail", "Account"), HttpStatusCode.BadRequest)); } if (updateUserContactContract.NewContactValue == updateUserContactContract.OldContactValue) { return(AjaxErrorResponse(m_localizationService.Translate("SameEmail", "Account"), HttpStatusCode.BadRequest)); } var client = GetUserClient(); client.UpdateCurrentUserContact(updateUserContactContract); await m_refreshUserManager.RefreshUserClaimsAsync(HttpContext); return(AjaxOkResponse()); }