Example #1
0
        //PUT /api/PersonalData/profile  Update profile info
        public IRestResponse PutPersonalDataProfile(UpdateProfileInfoRequest updateProfileInfoRequest)
        {
            var request = new RestRequest(resource + $"/profile", Method.PUT);

            request.AddHeader("api-key", apiKey);
            request.AddJsonBody(updateProfileInfoRequest);
            var response = client.Execute(request);

            return(response);
        }
        public async Task <bool> Handle(UpdateProfileInfoRequest message, IOutputPort <UpdateProfileInfoResponse> outputPort)
        {
            var user      = message.User;
            var firstName = message.FirstName;
            var lastName  = message.LastName;

            var response = await _userRepository.UpdateProfileInfo(user, firstName, lastName);

            if (!response.Success)
            {
                outputPort.Handle(new UpdateProfileInfoResponse(response.Errors));
            }

            outputPort.Handle(new UpdateProfileInfoResponse(response.UpdatedFields));
            return(true);
        }
Example #3
0
            public void PutPersonalDataProfileTest()
            {
                var client   = new FullPersonalDataModel().Init();
                var response = lykkeApi.PersonalData.PostPersonalData(client);

                Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK), "UnExpected status code");

                var updatedProfile = new UpdateProfileInfoRequest(client.Id);

                var putResponse = lykkeApi.PersonalData.PutPersonalDataProfile(updatedProfile);

                var updatedClient = lykkeApi.PersonalData.GetFullPersonalDataById(client.Id).GetResponseObject();

                Assert.That(updatedProfile.Address, Is.EqualTo(updatedClient.Address), "Unexpected Address");
                Assert.That(updatedProfile.Email, Is.EqualTo(updatedClient.Email), "Unexpected Email");
                Assert.That(updatedProfile.Facebook, Is.EqualTo(updatedClient.Facebook), "Unexpected Facebook");
                Assert.That(updatedProfile.Github, Is.EqualTo(updatedClient.Github), "Unexpected Github");
                Assert.That(updatedProfile.Twitter, Is.EqualTo(updatedClient.Twitter), "Unexpected Twitter");
                Assert.That(updatedProfile.Website, Is.EqualTo(updatedClient.Website), "Unexpected Website");
                Assert.That(updatedProfile.ClientId, Is.EqualTo(updatedClient.Id), "Unexpected ClientId");
            }
Example #4
0
 public async Task SavePersonalData([FromBody] UpdateProfileInfoRequest model)
 {
     model.ClientId = _userManager.GetCurrentUserId();
     await _personalDataService.UpdateProfileAsync(model);
 }
Example #5
0
 //PUT /api/PersonalData/profile  Update profile info
 public IResponse PutPersonalDataProfile(UpdateProfileInfoRequest updateProfileInfoRequest)
 {
     return(Request.Put(resource + $"/profile").WithHeaders("api-key", apiKey).AddJsonBody(updateProfileInfoRequest).Build().Execute());
 }