public Task<ResourceResponse<Document>> UpdatePersonAsync(Person person) { var doc = Client.CreateDocumentQuery<Document>(Collection.DocumentsLink) .Where(d => d.Id == person.Id) .AsEnumerable() // why the heck do we need to do this?? .FirstOrDefault(); return Client.ReplaceDocumentAsync(doc.SelfLink, person); }
//api/people public async Task<IHttpActionResult> Put(Person person) { var response = await _repo.UpdatePersonAsync(person); return Ok(response.Resource); }
//api/people public async Task<IHttpActionResult> Post(Person person) { var response = await _repo.CreatePerson(person); return Ok(response.Resource); }
public Task<ResourceResponse<Document>> CreatePerson(Person person) { return Client.CreateDocumentAsync(Collection.DocumentsLink, person); }