public void SeedSinglePage(ILikeItDbContext context, string name, string description, Category category, IList <string> tags, User user, Image image, bool like, string comment = "") { var page = new Page { Name = name, Category = category, Description = description, CreatedOn = DateTime.Now, User = user, Image = image, }; for (int i = 0; i < tags.Count; i++) { this.AddTag(page, tags[i]); } if (like) { this.AddLike(page, page.User); } else { this.AddDislike(page, page.User); } page.Rating = this.GetPageRating(page); if (!string.IsNullOrEmpty(comment)) { this.AddComment(page, page.User, comment); } context.Pages.Add(page); context.SaveChanges(); }
public void SeedSinglePage(ILikeItDbContext context, string name, string description, Category category, IList<string> tags, User user, Image image, bool like, string comment = "") { var page = new Page { Name = name, Category = category, Description = description, CreatedOn = DateTime.Now, User = user, Image = image, }; for (int i = 0; i < tags.Count; i++) { this.AddTag(page, tags[i]); } if (like) { this.AddLike(page, page.User); } else { this.AddDislike(page, page.User); } page.Rating = this.GetPageRating(page); if (!string.IsNullOrEmpty(comment)) { this.AddComment(page, page.User, comment); } context.Pages.Add(page); context.SaveChanges(); }
public LikeItData(ILikeItDbContext db) { this.db = db; this.repositories = new Dictionary <Type, object>(); }