public IResult PayByCreditCard(PayByCreditCardDto payByCreditCardDto) { CreditCard creditCard = payByCreditCardDto.CreditCard; Payment payment = new Payment(); payment.CustomerId = payByCreditCardDto.CustomerId; if (payByCreditCardDto.CreditCard.Id > 0) { payment.CreditCardId = payByCreditCardDto.CreditCard.Id; } payment.PaymentAmount = payByCreditCardDto.PaymentAmount; payment.PaymentDate = payByCreditCardDto.PaymentDate; IResult result = BusinessRules.Run(CheckIfCreditCard(creditCard)); if (result == null) { _paymentDal.Add(payment); return(new SuccessResult(Messages.PaymentAdded)); } else { return(result); } }
public IActionResult PayByCreditCard(PayByCreditCardDto payByCreditCardDto) { var result = _paymentService.PayByCreditCard(payByCreditCardDto); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }