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!")); }
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(); }
public static void DeleteFlight(Flight flight) { FlightRepository.DeleteFlight(flight); //Pass the flight details to the Flight Repository }
public static void DeleteFlight(int id) { FlightRepository.DeleteFlight(id); }
public ActionResult DeleteFlight(int flightId) { FlightRepository.DeleteFlight(flightId); TempData["Message"] = "Deleted Successfully"; return(RedirectToAction("DisplayFlight")); }