示例#1
0
        // Creates the folder in Firebase Firestore
        async Task CreateFolder(string folderName)
        {
            // Create folder key node
            var folderId = folderName.Replace(' ', '_');

            folderId = char.ToLower(folderId [0]) + folderId.Substring(1, folderId.Length - 1);

            // Create data to be saved in node
            var created    = FieldValue.ServerTimestamp;
            var folderData = new Dictionary <object, object> {
                { "created", created },
                { "lastModified", created },
                { "name", folderName },
                { "notesCount", 0 }
            };

            // Save data in folders collection
            await foldersCollection.GetDocument(folderId).SetDataAsync(folderData);

            await GetFolders();
        }
        async Task DeleteNote(Note note)
        {
            var batch        = AppDelegate.Database.CreateBatch();
            var noteDocument = notesCollection.GetDocument(note.Id);
            var folderData   = new Dictionary <object, object> {
                { "notesCount", --Folder.NotesCount },
                { "lastModified", FieldValue.ServerTimestamp }
            };

            await batch.DeleteDocument(noteDocument)
            .UpdateData(folderData, folderDocument)
            .CommitAsync();
        }
 public IDocumentReference GetDocument(string documentPath)
 {
     return(new DocumentReferenceWrapper(_wrapped.GetDocument(documentPath)));
 }
        public IDocumentReference Document(string documentPath)
        {
            var doccuntReference = _collectionReference.GetDocument(documentPath);

            return(new DocumentReferenceWrapper(doccuntReference));
        }