Exemple #1
0
        public async Task <PersonDTO> GetPerson(Guid personId)
        {
            var response = await this.GetAsync(FamilyTreePaths.PersonById(personId))
                           .ConfigureAwait(false);

            var responseContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

            return(response.IsSuccessStatusCode
                ? JsonConvert.DeserializeObject <PersonDTO>(responseContent, JsonSerializerSettings)
                : throw new Exception("Family Three SVC unavailable"));
        }
Exemple #2
0
        public async Task <PersonDTO> PutPerson(PersonDTO personDTO)
        {
            var request        = JsonConvert.SerializeObject(personDTO, JsonSerializerSettings);
            var requestContent = new StringContent(request, Encoding.UTF8, ContentType);

            var response = await this.PutAsync(FamilyTreePaths.PersonById(personDTO.ID), requestContent)
                           .ConfigureAwait(false);

            var responseContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

            return(response.IsSuccessStatusCode
                ? JsonConvert.DeserializeObject <PersonDTO>(responseContent, JsonSerializerSettings)
                : throw new Exception("Family Three SVC unavailable"));
        }