public IHttpActionResult UpdateFlight([FromBody] Flight flight, [FromUri] long id)
 {
     try
     {
         if (apiFacade.GetMyFlight(id) == null)
         {
             return(BadRequest(ModelState));
         }
         else
         {
             flight.Id = id;
             getAirlineFacade().UpdateFlight(airlineLoginToken, flight);
             return(Ok());
         }
     }
     catch (Exception e)
     {
         return(BadRequest(e.ToString()));
     }
 }
Example #2
0
 public IHttpActionResult PurchaseTicket(long flightId)
 {
     try
     {
         Flight flight = apiFacade.GetMyFlight(flightId);
         if (flight == null)
         {
             return(BadRequest(ModelState));
         }
         Ticket ticket = GetCustomerFacade().PurchaseTicket(GetCustLoginToken(), flight);
         return(Ok(ticket));
     }
     catch (Exception e)
     {
         return(BadRequest(e.ToString()));
     }
 }