Esempio n. 1
0
 public void Add(Whale whale)
 {
     using (var context = new WhaleRides())
     {
         context.Whales.Add(whale);
         context.SaveChanges();
     }
 }
Esempio n. 2
0
 public void Add(Ride ride)
 {
     using (var context = new WhaleRides())
     {
         context.Rides.Add(ride);
         context.SaveChanges();
     }
 }
Esempio n. 3
0
 public void Update(Whale whale)
 {
     using (var context = new WhaleRides())
     {
         var whaleDb = context.Whales.FirstOrDefault(x => x.Id == whale.Id);
         whaleDb.Name    = whale.Name;
         whaleDb.Species = whale.Species;
         context.SaveChanges();
     }
 }
Esempio n. 4
0
 public void Update(Ride ride)
 {
     using (var context = new WhaleRides())
     {
         var rideDb = context.Rides.FirstOrDefault(x => x.Id == ride.Id);
         rideDb.WhaleId  = ride.WhaleId;
         rideDb.Rider    = ride.Rider;
         rideDb.RideTime = ride.RideTime;
         context.SaveChanges();
     }
 }