private void btnSave_Click(object sender, EventArgs e) { var user = User.Clone(); this.CollectData<FullUser>(user); UpdateUserRequest request = new UpdateUserRequest(); request.token = Token; request.Form = user; request.Form.Roles = GetCheckedRoles(); SDKSync<CommonResponse>.CreateInstance(this).Execute(request, Save_Callback); }
public void TestUpdateUserRequest() { string json = @"{ ""default_space_guid"": ""076efaf3-160e-4c25-8871-88789319b127"" }"; UpdateUserRequest request = new UpdateUserRequest(); request.DefaultSpaceGuid = new Guid("076efaf3-160e-4c25-8871-88789319b127"); string result = JsonConvert.SerializeObject(request, Formatting.None); Assert.AreEqual(TestUtil.ToUnformatedJsonString(json), result); }
public async Task <IActionResult> UpdateUser([FromRoute] Guid id, [FromBody] UpdateUserRequest user) { _logger.LogInformation("Getting user"); try { var result = await _service.UpdateUserAsync(id.ToString(), user.FirstName, user.LastNames, user.BirthDate) .ConfigureAwait(false); return(StatusCode(result.StatusCode, result.Value)); } catch (Exception e) { _logger.LogCritical(e, "Error to get user"); return(StatusCode(HttpStatusCode.ServiceUnavailable, "UserService down")); } }
public async Task <IActionResult> UpdateUser([FromBody] UpdateUserRequest updatedUser) { _logger.LogInformation($"Attempt to update profile of user with email ${User.Identity.Name}"); ShopUser user = await _shopUserRepository.GetUserWithEmail(User.Identity.Name); if (user == null) { _logger.LogInformation("Attempt to update user profile failed, user with such email not found"); return(StatusCode((int)HttpStatusCode.NotFound, new ErrorResponse(ErrorReasons.NotFound, "User was not found."))); } await _shopUserRepository.UpdateUserProfile(user, updatedUser); _logger.LogInformation("User profile successfully updated"); return(StatusCode((int)HttpStatusCode.NoContent)); }
public async Task <IActionResult> Put([FromRoute] Request meta, [FromBody] UpdateUserRequest request) { IActionResult result = null; var updated = await Server.UpdateUserProfile(request.Id, request.FirstName, request.LastName, request.Email, request.Phone); if (updated) { result = Factory.CreateSuccessResponse(updated); } else { result = Factory.CreateNoContentResponse(); } return(result); }
public async Task <ActionResult <User> > Update([FromRoute] int id, [FromBody] UpdateUserRequest request) { var user = await _userRepository.FindByPk(id); if (user == null) { return(NotFound()); } var isNotCurrentUser = HttpContext.User.Identity.Name != user.Id.ToString(); var isNotAdministrator = !HttpContext.User.IsInRole("Administrator"); if (isNotCurrentUser && isNotAdministrator) { return(Forbid()); } if (request.IsEmailExist()) { user.Email = request.Email; } if (request.IsPasswordExist()) { if (request.IsPasswordNotValid()) { return(BadRequest()); } user.Password = request.Password; } if (request.Role.HasValue) { if (isNotAdministrator) { return(Forbid()); } user.Role = request.Role.Value; } await _userRepository.Update(user); return(user); }
public async Task <IActionResult> Edit(UpdateUserRequest model) { this.AddToken(); var response = await _userService.UpdateAsync(model.Id, model); if (response.IsSuccess) { return(RedirectToAction(nameof(Index))); } if (response.StatusCode == 404) { return(View("NotFound", model.Id)); } return(RedirectToAction("Login", "Account")); }
public async Task <IActionResult> Update([FromRoute] string userId, [FromBody] UpdateUserRequest request) { var user = await _usersService.GetUserById(userId); user.UserName = request.UserName; var updated = await _usersService.UpdateUser(user); if (!updated) { return(NotFound()); } else { return(Ok(user)); } }
public static User ConvertUpdateUserRequestToUser(UpdateUserRequest request) { User newPreson = new User(); newPreson.Id = request.Id; newPreson.Birthday = Convert.ToDateTime(request.Birthday); newPreson.MarryDate = request.MarryDate; newPreson.LastName = request.LastName; newPreson.Address = request.Address; newPreson.FirstName = request.FirstName; newPreson.Image = request.Image; newPreson.IsMale = request.IsMale; newPreson.Mail = request.Mail; newPreson.Password = request.Password; newPreson.UserName = request.UserName; return(newPreson); }
public ActionResult Edit(EditViewModel model) { var user = UserManager.FindById(model.Token); if (user != null) { // Verificar si los atributos Mail y Username se encuentran disponibles var auxUser = UserManager.FindByEmail(model.Email); if (auxUser != null && auxUser.Id != model.Token) { ModelState.AddModelError(string.Empty, "Ya existe un usuario con ese email."); return(View(model)); } auxUser = UserManager.FindByName(model.UserName); if (auxUser != null && auxUser.Id != model.Token) { ModelState.AddModelError(string.Empty, "Ya existe un usuario con ese nombre."); return(View(model)); } // Actualizar el usuario con los atributos del modelo user.Email = model.Email; if (user.UserName != "admin") { user.UserName = model.UserName; } // Persistir los cambios en la BD UserManager.Update(user); var userService = new UserService(); var request = new UpdateUserRequest { AspNetUserId = user.Id, Name = user.UserName, Email = user.Email }; var response = userService.UpdateUser(request); return(RedirectToAction("Index", "User")); } return(View(model)); }
public async Task <IActionResult> Update([FromBody] UpdateUserRequest updateUserRequest) { try { await _userHandler.Update(updateUserRequest); } catch (UnauthorizedAccessException) { return(Unauthorized()); } catch (UserNotFoundException) { return(NotFound()); } return(NoContent()); }
public async void Should_Return_Unauthorized_When_Put_Without_Logged_User() { // Arrange var userId = 3; RemoveClientAuthToken(_fixture.Client); var requestData = new UpdateUserRequest(); requestData.Name = "Some Test Name"; // Act var request = await _fixture.Client.PutAsJsonAsync($"api/v1/user/{userId}", requestData); // Assert Assert.Equal(HttpStatusCode.Unauthorized, request.StatusCode); }
public async Task <UserModel> UpdateAsync(Guid id, UpdateUserRequest request, CancellationToken token) { UserDbModel user = await _repository.GetAsync(id.ToString()); user.UserName = request.UserName; user.FirstName = request.FirstName; user.LastName = request.LastName; user.PhoneNumber = request.Phone; user.Email = request.Email; user.Photo = request.Photo; user.ModificationDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); await _repository.UpdateAsync(user); return(user.ConvertTo <UserModel>()); }
public async Task <ActionResult> EditUser(long id, UpdateUserRequest request) { if (!ModelState.IsValid) { return(View(new EditUserModel() { Id = id, LastName = request.LastName, FirstName = request.FirstName, Email = request.Email })); } _ = await _handler.UpdateAsync(id, request); return(RedirectToAction("List")); }
public IActionResult UpdateUser([FromBody] UpdateUserRequest user, CancellationToken cancellationToken) { if (user == null) { return(BadRequest()); } try { _userService.UpdateUser(User.GetUserId(), user.FirstName, user.LastName, cancellationToken).GetAwaiter().GetResult(); return(new OkResult()); } catch (SubscriptionException ex) { return(new ConflictActionResult(ex.Message)); } }
public async Task <IActionResult> Update(UpdateUserRequest request) { var user = _mapper.Map <User>(request); user.Id = request.Id; try { await _userService.Update(user, request.Password); return(Ok()); } catch (Exception ex) { return(BadRequest(new { message = ex.Message })); } }
private async Task TestUpdate(UpdateUserRequest request, User existingUser, string expectedUserName, string expectedPassword, Role expectedRole) { // Arrange _userRepositoryMock.Setup(mock => mock.Get(request.Id)).ReturnsAsync(existingUser); _userRepositoryMock.Setup(mock => mock.Get(It.Is <Name>(name => name.Value == request.UserName))).ReturnsAsync((User)null); // Act await _updateUserUseCase.Handle(request, _outputPortMock.Object); // Assert Assert.AreEqual(expectedUserName, existingUser.UserName.Value); Assert.AreEqual(expectedPassword, existingUser.Password.Value); Assert.AreEqual(expectedRole, existingUser.Roles.Single()); _userRepositoryMock.Verify(mock => mock.Update(existingUser)); _outputPortMock.Verify(mock => mock.Handle(It.Is <UpdateUserResponse>(response => response.SuccessFul))); }
public async Task <User> UpdateUserAsync(Guid id, UpdateUserRequest request) { User user = UsersRepository.FindBy(u => u.Id == id).FirstOrDefault(); if (user == null) { throw new Exception("User with that id does not exist"); } UserProfile profile = Mapper.Map <UserProfile>(request.Profile); user.Update(profile); await UnitOfWork.SaveChangesAsync(); return(user); }
public void Should_Fail_On_Last_Name_Too_Long() { var validator = new UpdateUserRequestValidator(); var mockRequest = new UpdateUserRequest() { FirstName = new string('*', 8), LastName = new string('*', 300), Sex = 1, Address = new string('*', 8), Phone = new string('*', 8), }; var result = validator.Validate(mockRequest); result.IsValid.Should().Be(false); result.Errors.FirstOrDefault(e => e.ErrorMessage == "Last name cannot be longer than 255 characters.").Should().NotBeNull(); }
public void Update() { var id = Guid.Parse("0528BD60-3D92-43CC-BFB4-A0D117D65CB6"); var body = new UpdateUserRequest() { Role = Guid.Parse("55201968-F7A4-481B-991A-92E69383F372"), Username = "******", Password = "******", }; var actionResult = _userController.Update(id, body); var objectResult = (ObjectResult)actionResult.Result; var objectResultValue = (Response)objectResult.Value; Assert.True(objectResult.StatusCode == (int)HttpStatusCode.OK, objectResultValue.Message); }
public void Should_Fail_On_Empty_Last_Name() { var validator = new UpdateUserRequestValidator(); var mockRequest = new UpdateUserRequest() { FirstName = new string('*', 8), LastName = string.Empty, Sex = 1, Address = new string('*', 8), Phone = new string('*', 8), }; var result = validator.Validate(mockRequest); result.IsValid.Should().Be(false); result.Errors.FirstOrDefault(e => e.ErrorMessage == "Last name cannot be empty.").Should().NotBeNull(); }
public void Should_Pass_On_Correct_Request() { var validator = new UpdateUserRequestValidator(); var mockRequest = new UpdateUserRequest() { FirstName = new string('*', 8), LastName = new string('*', 8), Sex = 1, Address = new string('*', 8), Phone = new string('*', 8), }; var result = validator.Validate(mockRequest); result.IsValid.Should().Be(true); result.Errors.Count.Should().Be(0); }
public UpdateUserResponse UpdateUser(UpdateUserRequest request) { UpdateUserResponse response = new UpdateUserResponse(); try { User user = request.ConvertToUser(); userRepository.Update(user); response.Success = true; } catch (Exception ex) { response.Message = ex.Message; response.Success = false; } return(response); }
public Task UpdateUserProfile(ShopUser user, UpdateUserRequest request) { if (user == null) { return(Task.CompletedTask); } if (user.Address == null) { user.UpdateUserFromRequestCreateAddress(request); } else { user.UpdateUserFromRequestUpdateAddress(request); } return(Task.CompletedTask); }
public ManagerResponse <UpdateUserResult, CommerceUser> UpdateUser(string userName, ProfileModel inputModel) { Assert.ArgumentNotNull(inputModel, nameof(inputModel)); UpdateUserResult result; var commerceUser = GetUser(userName).Result; if (commerceUser != null) { commerceUser.FirstName = inputModel.FirstName; commerceUser.LastName = inputModel.LastName; commerceUser.Email = inputModel.Email; commerceUser.SetPropertyValue("Phone", inputModel.TelephoneNumber); try { var request = new UpdateUserRequest(commerceUser); result = CustomerServiceProvider.UpdateUser(request); } catch (Exception ex) { result = new UpdateUserResult { Success = false }; result.SystemMessages.Add(new SystemMessage { Message = ex.Message + "/" + ex.StackTrace }); } } else { // user is authenticated, but not in the CommerceUsers domain - probably here because we are in edit or preview mode var message = DictionaryPhraseRepository.Current.Get("/System Messages/Account Manager/Update User Profile Error", "Cannot update profile details for user {0}."); message = string.Format(message, Context.User.LocalName); result = new UpdateUserResult { Success = false }; result.SystemMessages.Add(new SystemMessage { Message = message }); } result.WriteToSitecoreLog(); return(new ManagerResponse <UpdateUserResult, CommerceUser>(result, result.CommerceUser)); }
public async Task <IActionResult> Update([FromBody] UpdateUserRequest request) { var user = await _userService.GetUserAsync(HttpContext.GetUserId()); user.FirstName = request.FirstName; user.LastName = request.LastName; user.Gender = request.Gender; var updated = await _userService.UpdateUserAsync(user); if (updated) { return(Ok(_mapper.Map <UserResponse>(user))); } return(NotFound()); }
/// <summary> /// Updating a User /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/250/users/updating_a_user.html"</para> /// </summary> public async Task <UpdateUserResponse> UpdateUser(Guid?guid, UpdateUserRequest value) { UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget); uriBuilder.Path = string.Format(CultureInfo.InvariantCulture, "/v2/users/{0}", guid); var client = this.GetHttpClient(); client.Uri = uriBuilder.Uri; client.Method = HttpMethod.Put; client.Content = ((string)JsonConvert.SerializeObject(value)).ConvertToStream(); var expectedReturnStatus = 201; var response = await this.SendAsync(client, expectedReturnStatus); return(Utilities.DeserializeJson <UpdateUserResponse>(await response.Content.ReadAsStringAsync())); }
public void TestUpdateUser() { var getRequest = UpdateUserRequest.Builder() .AddId(1) .AddName("Nam Tran") .AddStartDate(DateTime.Now.ToString("yyyy/MM/dd")) .AddDeptId(1001) .AddLanguage("en_us") .AddMail("*****@*****.**"); Task <int> task = session.CallAsync(getRequest.GetRequest()); TestContext.Out.WriteLine("Take the second cup of coffee in meantime!"); int responseCode = task.Result; Assert.That(responseCode == 204, "Wrong response code!"); }
public bool UpdateUser(string idOrEmail, UpdateUserRequest request) { using (JsonSerializerConfigScope()) { var result = false; if (string.IsNullOrEmpty(idOrEmail)) { throw new ArgumentOutOfRangeException("idOrEmail", "Valid id, email address, or mention name (beginning with an '@') of the user required."); } if (string.IsNullOrEmpty(request.Name) || request.Name.Length > 50) { throw new ArgumentOutOfRangeException("name", "Valid length range: 1 - 50."); } if (string.IsNullOrEmpty(request.Email)) { throw new ArgumentOutOfRangeException("email", "Valid email of the user required."); } try { HipchatEndpoints.UpdateUserEndpointFormat .Fmt(idOrEmail) .AddHipchatAuthentication(_authToken) .PutJsonToUrl(data: request, responseFilter: resp => { if (resp.StatusCode == HttpStatusCode.NoContent) { result = true; } }); } catch (Exception exception) { Console.WriteLine(exception.Message); if (exception is WebException) { throw ExceptionHelpers.WebExceptionHelper(exception as WebException, "admin_group"); } throw ExceptionHelpers.GeneralExceptionHelper(exception, "UpdateUser"); } return(result); } }
public UpdateUserResponse Update(UpdateUserRequest request) { crypto.HashIterations = 10; crypto.SaltSize = 12; var response = new UpdateUserResponse(); try { //var user = request.MapTo<User>(); var user = DataContext.Users.Include(u => u.Role).Include(r => r.RolePrivileges).First(x => x.Id == request.Id).MapTo <User>(); user.Role = DataContext.RoleGroups.First(x => x.Id == request.RoleId); user.FullName = request.FullName; user.RolePrivileges.Clear(); if (request.RolePrivilegeIds.Count > 0) { foreach (var role in request.RolePrivilegeIds) { var rolePrivilege = DataContext.RolePrivileges.Find(role); user.RolePrivileges.Add(rolePrivilege); } } user.SignatureImage = request.SignatureImage; user.Position = request.Position; user.Username = request.Username; user.IsActive = request.IsActive; user.ChangeModel = request.ChangeModel; user.Email = request.Email; if (request.ChangePassword && request.Password != null) { user.PasswordSalt = crypto.GenerateSalt(crypto.HashIterations, crypto.SaltSize); user.Password = crypto.Compute(request.Password, user.PasswordSalt); } DataContext.Users.Attach(user); DataContext.Entry(user).State = EntityState.Modified; DataContext.SaveChanges(); response.IsSuccess = true; response.Message = "User item has been updated successfully"; } catch (DbUpdateException dbUpdateException) { response.Message = dbUpdateException.Message; } return(response); }
public async Task <IActionResult> Update([FromForm, Bind("UserId,Email,FirstName,LastName,Role")] UpdateUserViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var updateUserRequest = new UpdateUserRequest { UserId = model.UserId.Value, Role = model.Role, Email = model.Email, FullName = $"{model.FirstName} {model.LastName}" }; var response = await _userApplicationService.Handle(updateUserRequest); return(RedirectToAction(nameof(Index))); }
public static void UpdateUser() { var client = new AmazonIdentityManagementServiceClient(); var request = new UpdateUserRequest { UserName = "******", NewUserName = "******" }; try { var response = client.UpdateUser(request); } catch (EntityAlreadyExistsException) { Console.WriteLine("User 'NewUser' already exists."); } }
/// <summary> /// Updating a User /// <para>For detailed information, see online documentation at: "http://apidocs.cloudfoundry.org/195/users/updating_a_user.html"</para> /// </summary> public async Task<UpdateUserResponse> UpdateUser(Guid? guid, UpdateUserRequest value) { UriBuilder uriBuilder = new UriBuilder(this.Client.CloudTarget); uriBuilder.Path = string.Format(CultureInfo.InvariantCulture, "/v2/users/{0}", guid); var client = this.GetHttpClient(); client.Uri = uriBuilder.Uri; client.Method = HttpMethod.Put; var authHeader = await BuildAuthenticationHeader(); if (!string.IsNullOrWhiteSpace(authHeader.Key)) { client.Headers.Add(authHeader); } client.ContentType = "application/x-www-form-urlencoded"; client.Content = JsonConvert.SerializeObject(value).ConvertToStream(); var expectedReturnStatus = 201; var response = await this.SendAsync(client, expectedReturnStatus); return Utilities.DeserializeJson<UpdateUserResponse>(await response.ReadContentAsStringAsync()); }
private async Task UploadUserImage(User user, byte[] imageBytes) { var contentHelper = new ContentClientHelper(QuickbloxClient.ContentClient); var uploadId = await contentHelper.UploadPrivateImage(imageBytes); if (uploadId == null) { await QmunicateLoggerHolder.Log(QmunicateLogLevel.Warn, "SignUpViewModel. Failed to upload user image"); return; } UpdateUserRequest updateUserRequest = new UpdateUserRequest { User = new UserRequest { BlobId = uploadId } }; await QuickbloxClient.UsersClient.UpdateUserAsync(user.Id, updateUserRequest); }
/// <summary> /// Updates the user. /// </summary> /// <param name="storefront">The storefront.</param> /// <param name="visitorContext">The visitor context.</param> /// <param name="inputModel">The input model.</param> /// <returns> /// The manager response where the user is returned. /// </returns> public virtual ManagerResponse<UpdateUserResult, CommerceUser> UpdateUser([NotNull] CommerceStorefront storefront, [NotNull] VisitorContext visitorContext, ProfileModel inputModel) { Assert.ArgumentNotNull(storefront, "storefront"); Assert.ArgumentNotNull(visitorContext, "visitorContext"); Assert.ArgumentNotNull(inputModel, "inputModel"); UpdateUserResult result; var userName = visitorContext.UserName; var commerceUser = this.GetUser(userName).Result; if (commerceUser != null) { commerceUser.FirstName = inputModel.FirstName; commerceUser.LastName = inputModel.LastName; commerceUser.Email = inputModel.Email; commerceUser.SetPropertyValue("Phone", inputModel.TelephoneNumber); try { var request = new UpdateUserRequest(commerceUser); result = this.CustomerServiceProvider.UpdateUser(request); } catch (Exception ex) { result = new UpdateUserResult { Success = false }; result.SystemMessages.Add(new Sitecore.Commerce.Services.SystemMessage() { Message = ex.Message + "/" + ex.StackTrace }); } } else { // user is authenticated, but not in the CommerceUsers domain - probably here because we are in edit or preview mode var message = StorefrontManager.GetSystemMessage("UpdateUserProfileError"); message = string.Format(CultureInfo.InvariantCulture, message, Context.User.LocalName); result = new UpdateUserResult { Success = false }; result.SystemMessages.Add(new Commerce.Services.SystemMessage { Message = message }); } Helpers.LogSystemMessages(result.SystemMessages, result); return new ManagerResponse<UpdateUserResult, CommerceUser>(result, result.CommerceUser); }
public async Task<UserResponse> UpdateUserDataAsync(int qbUserId, UserRequest updateUserRequest) { var updateData = new UpdateUserRequest(); updateData.User = updateUserRequest; var response = await this.client.UsersClient.UpdateUserAsync(qbUserId, updateData); if (await HandleResponse(response, HttpStatusCode.OK)) { return response.Result; } return null; }
public object Put(UpdateUserRequest req) { if (!string.IsNullOrEmpty(req.AdditionalData)) throw new InvalidRequestDtoException () {ErrorMessage = "Setting of AdditionalData not allowed"}; throw new NotImplementedException(); }
public void UpdateUserTest() { using (ShimsContext.Create()) { MockClients clients = new MockClients(); string json = @"{ ""metadata"": { ""guid"": ""uaa-id-363"", ""url"": ""/v2/users/uaa-id-363"", ""created_at"": ""2015-05-19T15:27:24+00:00"", ""updated_at"": ""2015-05-19T15:27:24+00:00"" }, ""entity"": { ""admin"": false, ""active"": false, ""default_space_guid"": ""076efaf3-160e-4c25-8871-88789319b127"", ""default_space_url"": ""/v2/spaces/076efaf3-160e-4c25-8871-88789319b127"", ""spaces_url"": ""/v2/users/uaa-id-363/spaces"", ""organizations_url"": ""/v2/users/uaa-id-363/organizations"", ""managed_organizations_url"": ""/v2/users/uaa-id-363/managed_organizations"", ""billing_managed_organizations_url"": ""/v2/users/uaa-id-363/billing_managed_organizations"", ""audited_organizations_url"": ""/v2/users/uaa-id-363/audited_organizations"", ""managed_spaces_url"": ""/v2/users/uaa-id-363/managed_spaces"", ""audited_spaces_url"": ""/v2/users/uaa-id-363/audited_spaces"" } }"; clients.JsonResponse = json; clients.ExpectedStatusCode = (HttpStatusCode)201; var cfClient = clients.CreateCloudFoundryClient(); Guid? guid = Guid.NewGuid(); UpdateUserRequest value = new UpdateUserRequest(); var obj = cfClient.Users.UpdateUser(guid, value).Result; Assert.AreEqual("uaa-id-363", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true); Assert.AreEqual("/v2/users/uaa-id-363", TestUtil.ToTestableString(obj.EntityMetadata.Url), true); Assert.AreEqual("2015-05-19T15:27:24+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true); Assert.AreEqual("2015-05-19T15:27:24+00:00", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true); Assert.AreEqual("false", TestUtil.ToTestableString(obj.Admin), true); Assert.AreEqual("false", TestUtil.ToTestableString(obj.Active), true); Assert.AreEqual("076efaf3-160e-4c25-8871-88789319b127", TestUtil.ToTestableString(obj.DefaultSpaceGuid), true); Assert.AreEqual("/v2/spaces/076efaf3-160e-4c25-8871-88789319b127", TestUtil.ToTestableString(obj.DefaultSpaceUrl), true); Assert.AreEqual("/v2/users/uaa-id-363/spaces", TestUtil.ToTestableString(obj.SpacesUrl), true); Assert.AreEqual("/v2/users/uaa-id-363/organizations", TestUtil.ToTestableString(obj.OrganizationsUrl), true); Assert.AreEqual("/v2/users/uaa-id-363/managed_organizations", TestUtil.ToTestableString(obj.ManagedOrganizationsUrl), true); Assert.AreEqual("/v2/users/uaa-id-363/billing_managed_organizations", TestUtil.ToTestableString(obj.BillingManagedOrganizationsUrl), true); Assert.AreEqual("/v2/users/uaa-id-363/audited_organizations", TestUtil.ToTestableString(obj.AuditedOrganizationsUrl), true); Assert.AreEqual("/v2/users/uaa-id-363/managed_spaces", TestUtil.ToTestableString(obj.ManagedSpacesUrl), true); Assert.AreEqual("/v2/users/uaa-id-363/audited_spaces", TestUtil.ToTestableString(obj.AuditedSpacesUrl), true); } }
private async void SaveCommandExecute() { IsLoading = true; var updateUserRequest = new UpdateUserRequest {User = new UserRequest() {FullName = UserName}}; if (newImageBytes != null) { var contentHelper = new ContentClientHelper(QuickbloxClient); var imageUploadResult = await contentHelper.UploadPublicImage(newImageBytes); if (imageUploadResult != null) { var customData = new CustomData { AvatarUrl = imageUploadResult.Url, IsImport = "1" }; var customDataJson = JsonConvert.SerializeObject(customData); updateUserRequest.User.BlobId = imageUploadResult.BlodId; updateUserRequest.User.CustomData = customDataJson; } } var updateUserResponse = await QuickbloxClient.UsersClient.UpdateUserAsync(currentUser.Id, updateUserRequest); if (updateUserResponse.StatusCode == HttpStatusCode.OK) { var cachingQbClient = ServiceLocator.Locator.Get<ICachingQuickbloxClient>(); cachingQbClient.DeleteUserFromCacheById(currentUser.Id); NavigationService.GoBack(); } IsLoading = false; }