public void InsertMultipleUser() { var user_1 = new User { Account = "*****@*****.**", Password = "******", Type = UserType.admin }; var user_2 = new User { Account = "*****@*****.**", Password = "******", Type = UserType.user }; var user_3 = new User { Account = "*****@*****.**", Password = "******", Type = UserType.user }; using (var context = new RentalCarDb()) { context.Database.Log = Console.WriteLine; context.Users.AddRange(new List <User> { user_1, user_2, user_3 }); context.SaveChanges(); } }
public List <RenCar> GetAllRentalCars() { using (var context = new RentalCarDb()) { return((from e in context.Cars select e).ToList()); } }
public void InsertUser(User user) { using (var context = new RentalCarDb()) { context.Database.Log = Console.WriteLine; context.Users.Add(user); context.SaveChanges(); } }