Пример #1
0
 private void Seed()
 {
     using (var context = new ZuberDBContext(ContextOptions))
     {
         context.Database.EnsureDeleted();
         context.Database.EnsureCreated();
         context.Users.Add(new ZuberUser()
         {
             Id = 1, Name = "Pedro", Email = "*****@*****.**", PhoneNo = "12345678", Password = "******", Driver = false, DotId = 2
         });
         context.Users.Add(new ZuberUser()
         {
             Id = 2, Name = "Toni", Email = "*****@*****.**", PhoneNo = "87654321", Password = "******", Driver = true, DotId = 2, RideId = 1
         });
         context.Users.Add(new ZuberUser()
         {
             Id = 3, Name = "Catalina", Email = "*****@*****.**", PhoneNo = "666666666", Password = "******", Driver = false, DotId = 2
         });
         context.Dots.Add(new Dot()
         {
             Id = 2, Lat = 55.645518273899739, Long = 12.084714869877802, Description = "pick me up on klostervang pls", Hidden = false, ZuberUserID = 1
         });
         context.Dots.Add(new Dot()
         {
             Id = 3, Lat = 55.65054072652709, Long = 12.091409367317672, Description = "driving from Kund den stores vej", Hidden = false, ZuberUserID = 2
         });
         context.Dots.Add(new Dot()
         {
             Id = 4, Lat = 55.63691923296522, Long = 12.040578986958714, Description = "hyrdehøj", Hidden = false, ZuberUserID = 3
         });
         context.Rides.Add(new Ride()
         {
             Id = 1, PlacesRemaining = 3, DriverId = 2, CarDescription = "yellow opel"
         });
         context.SaveChanges();
     }
 }
Пример #2
0
 public void AddRide(Ride ride)
 {
     service.Rides.Add(ride);
     service.SaveChanges();
 }
Пример #3
0
 public void AddDot(Dot dot)
 {
     service.Dots.Add(dot);
     service.SaveChanges();
 }
Пример #4
0
 public void AddZuberUser(ZuberUser user)
 {
     user.Password = PasswordHash(user.Email, user.Password);
     service.Users.Add(user);
     service.SaveChanges();
 }