Exemplo n.º 1
0
        public async Task AddAsync(Roshambo c)
        {
            try
            {
                var result = await client.CreateDocumentAsync(RoshamboLink, c);

                c.Id = result.Resource.Id;
                Roshambos.Add(c);
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(@"ERROR {0}", e.Message);
            }
            //return c;
        }
Exemplo n.º 2
0
        public async Task RemoveAsync(Roshambo c)
        {
            try
            {
                //var query = client.CreateDocumentQuery<Roshambo>(RoshamboLink, new FeedOptions { MaxItemCount = 1 })
                //      .Where(item => item.Id == c.Id)
                //      .AsDocumentQuery();
                //await client.DeleteDocumentAsync(UriFactory.CreateDocumentUri(databaseId, collectionId, c.Id));
                //await client.ReplaceDocumentAsync(UriFactory.CreateDocumentUri(databaseId, collectionId, c.Id), new Roshambo());
                await client.DeleteDocumentAsync(UriFactory.CreateDocumentUri(databaseId, collectionId, c.Id));

                Roshambos.Remove(c);
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(@"ERROR {0}", e.Message);
            }
        }