Ejemplo n.º 1
0
 public IActionResult AddFlight([FromBody] Flight flight)
 {
     try
     {
         var res = repo.AddFlight(flight);
         if (res == 0)
         {
             return(BadRequest());
         }
         return(Ok());
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Ejemplo n.º 2
0
 public IActionResult AddFlight([FromBody] Flights flight)
 {
     _log4net.Info(" Http AddFlight request Initiated");
     if (flight == null)
     {
         return(BadRequest());
     }
     try
     {
         int res = repo.AddFlight(flight);
         if (res == 1)
         {
             return(Ok());
         }
         else
         {
             return(BadRequest("Transaction Could Not be completed"));
         }
     }
     catch (Exception)
     {
         return(BadRequest("Error occured during transaction."));
     }
 }