/// <summary> /// Deletes a trip by id. /// If the user is an admin, any trip from any user can be deleted. /// Otherwise, the user can only delete trips they have created. /// </summary> /// <param name="id">The id of the trip to delete.</param> /// <returns>The result of the request: Ok (200) or NotFound (404)</returns> public async Task <IHttpActionResult> Delete(string id) { var trip = GetTripForRole(id); if (trip == null) { return(NotFound()); } await _tripManager.DeleteTrip(trip); return(Ok()); }
public RedirectToRouteResult Delete(int Id) { _tripManager.DeleteTrip(Id); return(RedirectToAction("Index")); }
public async Task <IActionResult> DeleteSavedTrip(int userID, string answerCode) { await _trips.DeleteTrip(userID, answerCode); return(RedirectToAction("MyVacations")); }
public async Task <CommandResult <Boolean> > Delete(Guid tripId) { return(await _tripManager.DeleteTrip(tripId)); }