static void Main(string[] args) { VidzyContext vidzyContext = new VidzyContext(); var tags = new List<Tag>(); Video video = new Video { Classification = Classification.Gold, Genre = new Genre {Name = "Action"}, Name = "golsden eye", ReleaseDate = DateTime.Now, }; vidzyContext.Videos.Add(video); vidzyContext.SaveChanges(); }
static void Main(string[] args) { VidzyContext vidzyContext = new VidzyContext(); var tags = new List <Tag>(); Video video = new Video { Classification = Classification.Gold, Genre = new Genre { Name = "Action" }, Name = "golsden eye", ReleaseDate = DateTime.Now, }; vidzyContext.Videos.Add(video); vidzyContext.SaveChanges(); }
static void Main(string[] args) { using (VidzyContext context = new VidzyContext()) { var action = context.Genres.FirstOrDefault(g => g.Name == "Action"); var comedy = context.Genres.FirstOrDefault(g => g.Name == "Comedy"); var family = context.Genres.FirstOrDefault(g => g.Name == "Family"); context.Videos.Add(new Video { Name = "Bahubali", ReleaseDate = DateTime.Now.AddYears(-4), Classification = Classification.Platinum, Genre = action }); context.Videos.Add(new Video { Name = "Thanmatra", ReleaseDate = DateTime.Now.AddYears(-20), Classification = Classification.Gold, Genre = family }); context.Videos.Add(new Video { Name = "Johny English", ReleaseDate = DateTime.Now.AddYears(-6), Classification = Classification.Silver, Genre = comedy }); context.SaveChanges(); } }