private static void AddPhotographers(PhotoContext context) { var photographer1 = new Photographer() { Username = "******", Password = "******", Email = "*****@*****.**" }; var photographer2 = new Photographer() { Username = "******", Password = "******", Email = "*****@*****.**" }; var photographer3 = new Photographer() { Username = "******", Password = "******", Email = "*****@*****.**" }; var photographer4 = new Photographer() { Username = "******", Password = "******", Email = "*****@*****.**" }; context.Photographers.AddRange(new[] { photographer1, photographer2, photographer3, photographer4 }); context.SaveChanges(); }
static void Main(string[] args) { var context = new PhotoContext(); //context.Database.Initialize(true); //AddPhotographers(context); //AddAlbumsAndPhotos(context); }
private static void AddAlbumsAndPhotos(PhotoContext context) { var album1 = new Album() { Name = "Cvetq", BackgroundColor = "red", IsPublic = false, //Photographer = context.Photographers.Find(2) }; var album2 = new Album() { Name = "Circles", BackgroundColor = "green", IsPublic = true, //Photographer = context.Photographers.Find(3) }; var album3 = new Album() { Name = "Landscapes", BackgroundColor = "blue", IsPublic = false, //Photographer = context.Photographers.Find(4) }; var album4 = new Album() { Name = "People", BackgroundColor = "red", IsPublic = true, //Photographer = context.Photographers.Find(1) }; context.Albums.AddRange(new[] { album1, album2, album3, album4 }); var picture1 = new Picture() { Title = "Roza", Caption = "Mnogo rozi", Path = "C:/Pictures/", Album = album1 }; var picture2 = new Picture() { Title = "Pompa", Caption = "Voda", Path = "C:/Pictures/", Album = album4 }; var picture3 = new Picture() { Title = "Grozde", Caption = "Malkoto zrunce", Path = "C:/Pictures/", Album = album2 }; var picture4 = new Picture() { Title = "Rakiq", Caption = "Mnogo rakiq", Path = "C:/Pictures/", Album = album1 }; var picture5 = new Picture() { Title = "Treva", Caption = "Mnogo treva", Path = "C:/Pictures/", Album = album3 }; var picture6 = new Picture() { Title = "Mag", Caption = "Mnogo magove", Path = "C:/Pictures/", Album = album1 }; var picture7 = new Picture() { Title = "Rezachka", Caption = "Srqzvashto", Path = "C:/Pictures/", Album = album2 }; context.Pictures.AddRange(new[] { picture1, picture2, picture3, picture4, picture5, picture6, picture7 }); context.SaveChanges(); }