private static void AddManyToManyObject() { var context = new SnowboardAppContext(); var athlete = new Athlete { FirstName = "Torsten", LastName = "Horgmo", Age = 28, BirthCountry = "Norway", }; var contest = context.Contests.Find(1); context.Add(athlete); context.Add(new AthleteContest { Athlete = athlete, Contest = contest }); context.SaveChanges(); }
private static void AddSnowboardsToAthelte() { var context = new SnowboardAppContext(); var snowboard = new Snowboard { Brand = "Rome", Length = 150, Name = "SKS", AthelteId = 14 }; context.Add(snowboard); context.SaveChanges(); var snowboard1 = new Snowboard { Brand = "Brädan1337", Length = 1337, Name = "ELIT", AthelteId = 14 }; context.Add(snowboard1); context.SaveChanges(); }