public ActionResult <int> PostTripTask(int id, TripTask activity) { if (id < 0) { return(NotFound()); } IdentityUser currentUser = GetCurrentUser(); if (currentUser == null) { return(BadRequest()); } Trip trip = _tripRepository.GetByWithActivities(id); if (trip == null) { return(NotFound()); } trip.TripTasks.Add(activity); _tripRepository.SaveChanges(); return(Ok(activity.Id)); }
public ActionResult DeleteTripTask(int id) { if (id < 0) { return(NotFound()); } IdentityUser currentUser = GetCurrentUser(); if (currentUser == null) { return(BadRequest()); } TripTask a = _tripRepository.GetTripTaskBy(id); _tripRepository.DeleteTripTask(a); _tripRepository.SaveChanges(); return(Ok()); }