public void UpdateUserInfo(string token, UserInfoUpdate info, Action <UserInfo> onSuccess, Action <Error> onError = null) { Action <UserInfo> successCallback = newInfo => { _userCache[token] = newInfo; onSuccess?.Invoke(newInfo); }; XsollaLogin.Instance.UpdateUserInfo(token, info, successCallback, onError); }
public async Task <dynamic> Update([FromBody] UserInfoUpdate item) { if (item == null) { return new { JsonString = "Error" } } ; var currentUser = JwtIdentity.UserInfo(Thread.CurrentPrincipal.Identity); //item.SubmiterUserId = currentUser.Id; var result = await _sqlData.UserInfo.Update(item); return(new { Result = JsonConvert.DeserializeObject(result) }); }
public HttpResponseMessage EditUserInfo(UserInfoUpdate model, int id) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } SucessResponse response = new SucessResponse(); _userDataService.Update(model); return(Request.CreateResponse(response)); }
public void Update(UserInfoUpdate model) { DataProvider.ExecuteNonQuery(GetConnection, "dbo.Users_Update", inputParamMapper : delegate(SqlParameterCollection u) { u.AddWithValue("@Id", model.Id); u.AddWithValue("@FirstName", model.FirstName); u.AddWithValue("@LastName", model.LastName); u.AddWithValue("@UserName", model.UserName); u.AddWithValue("@Email", model.Email); u.AddWithValue("@Phone", model.Phone); u.AddWithValue("@Gender", model.Gender); u.AddWithValue("@Bio", model.Bio); u.AddWithValue("@CoverPhotoId", model.CoverPhotoId); u.AddWithValue("@AvatarPhotoId", model.AvatarPhotoId); }); }
private void SetNickname(string newNickname) { var isNicknameUpdateInProgress = true; ShowWaiting(() => isNicknameUpdateInProgress); var token = Token.Instance; var updatePack = new UserInfoUpdate() { nickname = newNickname }; SdkLoginLogic.Instance.UpdateUserInfo(token, updatePack, onSuccess: _ => isNicknameUpdateInProgress = false, onError: error => { Debug.LogError("Could not update user info"); isNicknameUpdateInProgress = false; StoreDemoPopup.ShowError(error); }); }
private void UpdateCommonEntries(UserProfileEntryType entryType, string newValue) { var infoUpdatePack = new UserInfoUpdate(); var isValueValid = newValue.Length <= 255; switch (entryType) { case UserProfileEntryType.DateOfBirth: if (DateTime.TryParse(newValue, out DateTime birthday)) { infoUpdatePack.birthday = newValue; } else { isValueValid = false; } break; case UserProfileEntryType.FirstName: infoUpdatePack.first_name = newValue; break; case UserProfileEntryType.Gender: if (newValue == UserProfileGender.MALE_SHORT || newValue == UserProfileGender.FEMALE_SHORT || newValue == UserProfileGender.OTHER_LOWERCASE || newValue == UserProfileGender.PREFER_NOT_LOWERCASE) { infoUpdatePack.gender = newValue; } else { isValueValid = false; } break; case UserProfileEntryType.LastName: infoUpdatePack.last_name = newValue; break; case UserProfileEntryType.Nickname: StartCoroutine(UpdateUpperRightCornerInfoOnCompletion()); infoUpdatePack.nickname = newValue; break; } if (!isValueValid) { ShowInvalidValue(entryType, newValue); _isProfileUpdated = false; return; } var token = Token.Instance; SdkLoginLogic.Instance.UpdateUserInfo(token, infoUpdatePack, onSuccess: newInfo => { InitializeEntries(newInfo); _isProfileUpdated = true; }, onError: _commonErrorCallback); }