protected override async Task Handle(DeleteTripCommand request, CancellationToken cancellationToken) { var trip = await _tripsRepository.GetBriefByIdAsync(request.TripId); if (trip != null) { _tripsRepository.Delete(trip); } }
public async Task <ActionResult> Delete(int id) { try { bool success = await tripsRepository.Delete(id); if (success) { return(Ok()); } else { return(NotFound()); } } catch (Exception e) { return(StatusCode(500, e)); } }