Example #1
0
        /*Cry detect DB configuration end*/

        /*Mobile response for baby cry start*/
        public static async Task <Document> CryMobileResAsync(Models.Sound sound)
        {
            // return await client.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri(DatabaseId, CollectionId2), sound);

            Document doc = client.CreateDocumentQuery <Document>(
                UriFactory.CreateDocumentCollectionUri(DatabaseId, CollectionId1))
                           .Where(f => f.Id == sound.Id).AsEnumerable().SingleOrDefault();

            //Update some properties on the found resource
            doc.SetPropertyValue("responseDone", sound.ResponseDone);
            doc.SetPropertyValue("response", sound.Response);
            doc.SetPropertyValue("dateTime", sound.DateTime);

            //Now persist these changes to the database by replacing the original resource
            Document updated = await client.ReplaceDocumentAsync(doc);

            return(updated);
        }
Example #2
0
        /*Mobile response for baby cry end*/

        /*Post change iot done response start*/
        public static async Task <Document> UpdateMobileResAsync(Models.Sound sound)
        {
            //Fetch the Document to be updated

            /* Document doc = client.CreateDocumentQuery<Document>(DatabaseId,CollectionId2)
             *                          .Where(r => r.Id == "9")
             *                          .AsEnumerable()
             *                          .SingleOrDefault();*/

            Document doc = client.CreateDocumentQuery <Document>(
                UriFactory.CreateDocumentCollectionUri(DatabaseId, CollectionId1))
                           .Where(f => f.Id == sound.Id).AsEnumerable().SingleOrDefault();

            //Update some properties on the found resource
            doc.SetPropertyValue("status", sound.Status);

            //Now persist these changes to the database by replacing the original resource
            Document updated = await client.ReplaceDocumentAsync(doc);

            return(updated);
        }