示例#1
0
        public static DocumentPages GetDocumentById(ObjectId objectId)
        {
            DocumentPages doc = new DocumentPages();

            using (var db = new LiteDatabase(DataLocation))
            {
                var col = db.GetCollection <DocumentPages>(CollectionName);

                doc = col.FindById(objectId);
            }

            return(doc);
        }
示例#2
0
        public static bool InsertUpdateDocument(DocumentPages documentPages)
        {
            bool isSuccess = false;

            using (var db = new LiteDatabase(DataLocation))
            {
                var col = db.GetCollection <DocumentPages>(CollectionName);

                try
                {
                    col.Upsert(documentPages);
                    isSuccess = true;
                }
                catch (Exception) { }
            }

            return(isSuccess);
        }