Esempio n. 1
0
        public async Task <IActionResult> Delete(int id)
        {
            var trip = _repository.GetTripById(id);

            if (trip == null)
            {
                return(NotFound());
            }
            _repository.DeleteTrip(trip);

            if (await _repository.SaveChangesAsync())
            {
                return(Ok("Trip Deleted"));
            }

            return(BadRequest("Failed to Delete Trip"));
        }