/// <summary> /// /// </summary> /// <param name="car"></param> /// <returns>The id of the newly created car</returns> public int Create(Car car) { _context.Add(car); _context.SaveChanges(); var id = from c in _context.Car where c.Equals(car) select c.CarId; return(id.FirstOrDefault()); }
public static void Clear(Slot_Car_TournamentContext context) { context.Database.ExecuteSqlCommand("DELETE * FROM CarInRace"); context.SaveChanges(); context.Database.ExecuteSqlCommand("DELETE * FROM Race"); context.SaveChanges(); context.Database.ExecuteSqlCommand("DELETE * FROM Cars"); context.SaveChanges(); context.Database.ExecuteSqlCommand("DELETE * FROM Track"); context.SaveChanges(); }
public static void Main(string[] args) { using (var context = new Slot_Car_TournamentContext()) { Seed(context); context.SaveChanges(); } }