Пример #1
0
        public void SaveToDatabase(bool @override)
        {
            var allItem = provider.All();

            if (!@override)
            {
                allItem = allItem.Where(it => null == Get(it));
            }
            var dummy = allItem.ToList();

            foreach (var item in dummy)
            {
                UpdateOrAdd(item, item);
            }
        }
Пример #2
0
        public void Import(System.IO.Stream zipStream, bool @override)
        {
            var allItem = fileProvider.All();

            foreach (var item in allItem)
            {
                fileProvider.Remove(item);
            }
            fileProvider.Import(zipStream, @override);
            allItem = fileProvider.All();
            if (!@override)
            {
                allItem = allItem.Where(it => null == Get(it));
            }
            var dummy = allItem.ToList();

            foreach (var item in dummy)
            {
                var tempItem = fileProvider.Get(item);
                InsertOrUpdate(tempItem, tempItem);
            }
        }