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")); }
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")); }