public IHttpActionResult Put(PaymentTransaction paymentTransaction)
 {
     try
     {
         var paymentTransactionManagement = new PaymentTransactionManagement();
         paymentTransactionManagement.Update(paymentTransaction);
         apiResponse = new ApiResponse();
         return(Ok(apiResponse));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
 // GET api/<controller>
 public IHttpActionResult Get()
 {
     try
     {
         var paymentTransactionManagement = new PaymentTransactionManagement();
         apiResponse = new ApiResponse();
         var paymentTransaction = paymentTransactionManagement.RetrieveAll();
         apiResponse.Data = paymentTransaction;
         return(Ok(apiResponse));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
 public IHttpActionResult Post(PaymentTransaction paymentTransaction)
 {
     try
     {
         var paymentTransactionManagement = new PaymentTransactionManagement();
         paymentTransaction.TransactionDate = DateTime.Now;
         paymentTransactionManagement.Create(paymentTransaction);
         apiResponse         = new ApiResponse();
         apiResponse.Message = "Pago realizado con exito.";
         return(Ok(apiResponse));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
        public async System.Threading.Tasks.Task <IHttpActionResult> PaymentTransactionv2Async(PaymentTransactionV2 paymentTransactionV2)
        {
            try
            {
                var paymentTransactionManagement = new PaymentTransactionManagement();
                var paymentTransaction           = paymentTransactionV2.getV1();
                var response = PayPalAPI.SendPaymentToHotel(paymentTransactionV2.PaypalEmail, (paymentTransactionV2.TotalAmount - paymentTransactionV2.CommissionTotal).ToString());

                paymentTransactionManagement.Create(paymentTransaction);
                apiResponse         = new ApiResponse();
                apiResponse.Message = "Pago realizado con exito.";
                return(Ok(apiResponse));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
 // GET api/<controller>/5
 public IHttpActionResult Get(int id)
 {
     try
     {
         var paymentTransactionManagement = new PaymentTransactionManagement();
         var paymentTransaction           = new PaymentTransaction()
         {
             Id = id
         };
         paymentTransaction = paymentTransactionManagement.RetrieveById(paymentTransaction);
         apiResponse        = new ApiResponse
         {
             Data = paymentTransaction
         };
         return(Ok(apiResponse));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
 public IHttpActionResult Delete(int id)
 {
     try
     {
         var paymentTransactionManagement = new PaymentTransactionManagement();
         var paymentTransaction           = new PaymentTransaction()
         {
             Id = id
         };
         paymentTransactionManagement.Delete(paymentTransaction);
         apiResponse = new ApiResponse
         {
             Message = "Eliminado exitosamente"
         };
         return(Ok(apiResponse));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }