示例#1
0
        public void ImportCategoryData(Models.Repository repository, IEnumerable <Models.Category> data)
        {
            var dataCollection = repository.GetCategoriesCollection();
            var docs           = data.Select(it => it.ToBsonDocument()).ToArray();

            if (docs.Length > 0)
            {
                dataCollection.InsertBatch(docs);
            }
        }
示例#2
0
        public IEnumerable <Models.Category> ExportCategoryData(Models.Repository repository)
        {
            var collection = repository.GetCategoriesCollection();

            return(collection.FindAll().Select(it => it.ToCategory()));
        }