示例#1
0
        /// <summary>
        /// Seed with sample feeds
        /// </summary>
        /// <returns></returns>
        private IEnumerable <Feed> SeedFeeds()
        {
            //seed some sample feeds
            IList <string> sampleFeedCategories = new List <string>()
            {
                "Movies",
                "News",
                "Astrology",
                "Gaming",
                "Gardening"
            };

            foreach (var category in sampleFeedCategories)
            {
                _context.Feeds.Add(new Feed()
                {
                    Name             = category,
                    ShortDescription = $"This is a short {category} feed description",
                    LongDescription  = $"A lot of text could go in this {category} feed description",
                });
            }
            _context.SaveChanges();
            return(_context.Feeds.AsEnumerable());
        }