Exemplo n.º 1
0
        public async Task <HttpResponseMessage> DeleteFlight([FromBody] string id)
        {
            bool deleted = await FlightRepository.DeleteFlight(new ObjectId(id));

            if (deleted)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, "Successfully deleted."));
            }
            return(Request.CreateResponse(HttpStatusCode.InternalServerError, "While deleting flight, error occurred!"));
        }
Exemplo n.º 2
0
        public static bool DeleteFlight(int code)
        {
            var user = UserSession.Current.User;

            if (user != null)
            {
                var repo   = new FlightRepository(false, actionCode: (int)Constants.FlightAction.Code, code: code);
                var flight = repo.List.FirstOrDefault() ?? new Flight();
                var result = repo.DeleteFlight();
                if (result)
                {
                    var task = new Task(() => InformationManager.DeleteFlight(flight.Plan, flight));
                    task.Start();
                    UpdatePlan(flight.Plan, true);
                }
                return(result);
            }
            throw new Exception();
        }
Exemplo n.º 3
0
 public static void DeleteFlight(Flight flight)
 {
     FlightRepository.DeleteFlight(flight);                       //Pass the flight details to the Flight Repository
 }
Exemplo n.º 4
0
 public static void DeleteFlight(int id)
 {
     FlightRepository.DeleteFlight(id);
 }
Exemplo n.º 5
0
 public ActionResult DeleteFlight(int flightId)
 {
     FlightRepository.DeleteFlight(flightId);
     TempData["Message"] = "Deleted Successfully";
     return(RedirectToAction("DisplayFlight"));
 }