示例#1
0
        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);
        }
示例#2
0
 //api/people
 public async Task<IHttpActionResult> Put(Person person)
 {
     var response = await _repo.UpdatePersonAsync(person);
     return Ok(response.Resource);
 }
示例#3
0
 //api/people
 public async Task<IHttpActionResult> Post(Person person)
 {
     var response = await _repo.CreatePerson(person);
     return Ok(response.Resource);
 }
示例#4
0
 public Task<ResourceResponse<Document>> CreatePerson(Person person)
 {
     return Client.CreateDocumentAsync(Collection.DocumentsLink, person);
 }