コード例 #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"));
        }
コード例 #2
0
        public async Task <ChildDTO> PutChild(Guid personId, ChildDTO childDTO)
        {
            var request        = JsonConvert.SerializeObject(childDTO, JsonSerializerSettings);
            var requestContent = new StringContent(request, Encoding.UTF8, ContentType);

            var response = await this.PutAsync(FamilyTreePaths.PutChild(personId, childDTO.Id), requestContent)
                           .ConfigureAwait(false);

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

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