Ejemplo n.º 1
0
 public async Task AddAsync(PorpoiseSighting porpoise)
 {
     using (var context = new PorpoiseSightingsContext())
     {
         context.PorpoiseSightings.Add(porpoise);
         await context.SaveChangesAsync();
     }
 }
Ejemplo n.º 2
0
 public async Task AddAsync(SightingTrip sightingTrip)
 {
     using (var context = new PorpoiseSightingsContext())
     {
         context.SightingTrips.Add(sightingTrip);
         await context.SaveChangesAsync();
     }
 }
Ejemplo n.º 3
0
 public async Task UpdateAsync(PorpoiseSighting porpoiseSighting)
 {
     using (var context = new PorpoiseSightingsContext())
     {
         var porpoiseSightingDb = context.PorpoiseSightings.FirstOrDefault(x => x.Id == porpoiseSighting.Id);
         porpoiseSightingDb.Name      = porpoiseSighting.Name;
         porpoiseSightingDb.Species   = porpoiseSighting.Species;
         porpoiseSightingDb.Latitude  = porpoiseSighting.Latitude;
         porpoiseSightingDb.Longitude = porpoiseSighting.Longitude;
         porpoiseSightingDb.Time      = porpoiseSighting.Time;
         await context.SaveChangesAsync();
     }
 }
Ejemplo n.º 4
0
        public async Task UpdateAsync(SightingTrip sightingTrip)
        {
            using (var context = new PorpoiseSightingsContext())
            {
                var sightingTripDb = await context.SightingTrips.FirstOrDefaultAsync(x => x.Id == sightingTrip.Id);

                if (sightingTripDb != null)
                {
                    sightingTripDb.Captain       = sightingTrip.Captain;
                    sightingTripDb.DepartureTime = sightingTrip.DepartureTime;
                    await context.SaveChangesAsync();
                }
            }
        }