private void CreateBlogPosts() { var sampleText = string.Empty; for (var j = 0; j < 2; j++) { sampleText += $"<p>Cold-pressed pok pok salvia, enamel pin next level vape trust fund. Pabst williamsburg live-edge brunch selfies, 3 wolf moon tofu synth.</p> {getSampleCode()} <p>Hammock green juice copper mug yr. Chia tbh fingerstache skateboard meggings tumeric. Affogato butcher succulents, art party synth retro waistcoat literally kogi twee</p>"; } for (var i = 0; i < 40; i++) { var newPost = new BlogPost { Title = $"My first blog - Part {i}!", Body = sampleText, DatePublished = DateTime.UtcNow, IsPublished = true }; _ctx.BlogPosts.Add(newPost); _ctx.SaveChanges(); } }
public T Add(T entity) { _dbSet.Add(entity); _dbContext.SaveChanges(); return(entity); }