public async Task <PayPal_Payment> CreatePayment(PayPalPaymentModel payment, int paymentDonationId) { PayPal_Payment newPayPalPayment = new PayPal_Payment { Status = payment.Status, CreateDate = payment.CreatedDate, EmailAddress = payment.EmailAddress, PayerId = payment.PayerId, PayPalId = payment.PayPalId, PaymentDonationId = paymentDonationId }; await Context.PayPal_Payments.AddAsync(newPayPalPayment); await Context.SaveChangesAsync(); return(newPayPalPayment); }
public async Task <ActionResult <PayPal_Payment> > CreateGroup(int portalId, [FromBody] PayPalPaymentModel payment) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } PaymentDonationModel newPaymentDonation = new PaymentDonationModel { Amount = payment.Amount, Processor = payment.Processor, Type = payment.Type }; Payment_Donation paymentDonation = await _paymentDonationRepository.CreatePaymentDonation(portalId, newPaymentDonation); PayPal_Payment payPayPayment = await _payPalPaymentRepository.CreatePayment(payment, paymentDonation.Id); return(Ok(payPayPayment)); }