Exemple #1
0
        /// <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());
        }
Exemple #2
0
        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();
        }
Exemple #3
0
 public static void Main(string[] args)
 {
     using (var context = new Slot_Car_TournamentContext())
     {
         Seed(context);
         context.SaveChanges();
     }
 }