Example #1
0
 public void Insert(Trips trip)
 {
     if (trip != null)
     {
         _tripsContext.Trip.Add(trip);
         _tripsContext.SaveChanges();
     }
 }
Example #2
0
 public IActionResult AddTrip([FromBody] Trips.Models.Trips trip)
 {
     if (trip != null)
     {
         _tripsServices.Insert(trip);
     }
     return(Ok());
 }
Example #3
0
        public void Update(int id, Trips trip)
        {
            var e = _tripsContext.Trip.FirstOrDefault(m => m.Id == id);

            if (e != null)
            {
                e.Name          = trip.Name;
                e.Description   = trip.Description;
                e.DateStarted   = trip.DateStarted;
                e.DateCompleted = trip.DateCompleted;
                _tripsContext.SaveChanges();
            }
        }
Example #4
0
 public IActionResult UpdateTrip(int id, [FromBody] Trips.Models.Trips trip)
 {
     _tripsServices.Update(id, trip);
     return(Ok(trip));
 }