public IHttpActionResult HardDeleteFlight(int?id)
        {
            if (!User.IsInRole(AvailableRoles.DatabaseManager))
            {
                return(BadRequest("You have not access to delete the flight.\nPlease contact your Database Manager."));
            }

            //The HardDeleteFlight Action will remove every record in database that relates with the flight
            if (!id.HasValue)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            var flightDb = flightRepository.GetSingleFlight(id ?? (int)InvalidPropertyValues.undefinedValue);

            if (flightDb == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            var flightTickets = ticketRepository.GetTicketsOfFlight(flightDb.FlightId);

            ClearOrders(flightTickets);
            ticketRepository.RemoveMultipleTicket(flightTickets);

            flightRepository.Remove(flightDb);

            unitOfWork.Complete();

            var flightService = new FlightHubService();

            flightService.FlightDeleted(id ?? (int)InvalidPropertyValues.undefinedValue);

            return(Ok());
        }
        public IHttpActionResult DeleteFlight(int?id)
        {
            if (!id.HasValue)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            var flightDb = flightRepository.GetSingleFlight(id ?? (int)InvalidPropertyValues.undefinedValue);

            if (flightDb == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            var flightTickets = ticketRepository.GetTicketsOfFlight(flightDb.FlightId);

            if (flightTickets.Any())
            {
                return(BadRequest("The Flight has purchased Tickets!\nTo delete it contact your Database Manager."));
            }

            flightRepository.Remove(flightDb);

            unitOfWork.Complete();

            var flightService = new FlightHubService();

            flightService.FlightDeleted(id ?? (int)InvalidPropertyValues.undefinedValue);

            return(Ok());
        }