Exemple #1
0
        private void updprofbtn_Click(object sender, EventArgs e)
        {
            try
            {
                var profilesApi = new IO.Swagger.Api.ProfilesApi(Configuration);
                var profile     = profilesApi.ProfilesGetSchema(48, true);

                //Update a standard field of the profile

                var oggetto = profile.Fields.FirstOrDefault(i =>
                                                            i.Name.Equals("DOCNAME", StringComparison.CurrentCultureIgnoreCase));
                ((SubjectFieldDTO)oggetto).Value = "Update from API call (DEV EXAMPLE)";

                //Update a additional field of the profile

                var numerofattura = profile.Fields.FirstOrDefault(i =>
                                                                  i.ExternalId != null && i.ExternalId.Equals("CodFatt", StringComparison.CurrentCultureIgnoreCase));
                ((AdditionalFieldStringDTO)numerofattura).Value = "CodFatt value (DEV EXAMPLE)";

                var profileToUpdate = new ProfileDTO();
                profileToUpdate.Fields = profile.Fields;
                profilesApi.ProfilesPut(48, profileToUpdate);

                MessageBox.Show("Profile Updated");
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }