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); } }
public IEnumerable <Models.Category> ExportCategoryData(Models.Repository repository) { var collection = repository.GetCategoriesCollection(); return(collection.FindAll().Select(it => it.ToCategory())); }