private static void ClearDatabase() { var context = new TweeterLikeContext(); context.Replies.Delete(); context.Posts.Delete(); context.Users.Delete(); context.SaveChanges(); }
private static void SeedPosts(TweeterLikeContext context) { context.Posts.Add(new Post() { Title = "PostWithoutReplies", Comment = "PostWithoutReplies", Replies = new List <Reply>(), Author = new ApplicationUser() { UserName = "******", Id = "SeedSeed" } }); context.Posts.Add(new Post() { Title = "PostWithReplies", Comment = "PostWithReplies", Replies = new List <Reply>() { new Reply() { Author = new ApplicationUser() { UserName = "******", Id = "SeedSeed2" }, Comment = "FirstReply" }, new Reply() { Author = new ApplicationUser() { UserName = "******", Id = "SeedSeed3" }, Comment = "SecondReply" }, }, Author = new ApplicationUser() { UserName = "******", Id = "SeedSeed4" } }); context.SaveChanges(); }
private static void SeedPosts(TweeterLikeContext context) { context.Posts.Add(new Post() { Title = "PostWithoutReplies", Comment = "PostWithoutReplies", Replies = new List<Reply>(), Author = new ApplicationUser() { UserName = "******", Id = "SeedSeed" } }); context.Posts.Add(new Post() { Title = "PostWithReplies", Comment = "PostWithReplies", Replies = new List<Reply>() { new Reply() { Author = new ApplicationUser() {UserName = "******", Id = "SeedSeed2"}, Comment = "FirstReply" }, new Reply() { Author = new ApplicationUser() {UserName = "******", Id = "SeedSeed3"}, Comment = "SecondReply" }, }, Author = new ApplicationUser() {UserName = "******", Id = "SeedSeed4"} }); context.SaveChanges(); }