示例#1
0
        /// <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());
        }
示例#2
0
        public RedirectToRouteResult Delete(int Id)
        {
            _tripManager.DeleteTrip(Id);

            return(RedirectToAction("Index"));
        }
示例#3
0
        public async Task <IActionResult> DeleteSavedTrip(int userID, string answerCode)
        {
            await _trips.DeleteTrip(userID, answerCode);

            return(RedirectToAction("MyVacations"));
        }
示例#4
0
 public async Task <CommandResult <Boolean> > Delete(Guid tripId)
 {
     return(await _tripManager.DeleteTrip(tripId));
 }