Exemple #1
0
        public bool GenerateAndSaveData()
        {
            var feed = _feedBuilder.Build();

            if (feed == null)
            {
                return(false);
            }

            var feedData = new FeedData
            {
                Created = feed.Updated
            };

            using (var ms = new MemoryStream())
            {
                var serializer = new XmlSerializer(typeof(Feed), Ns);
                serializer.Serialize(ms, feed);
                feedData.FeedBytes = ms.ToArray();
            }

            _feedRepository.Save(feedData);

            // we only need to keep one version - remove older ones to avoid filling up the database
            _feedRepository.RemoveOldVersion();

            return(true);
        }