public void Create(Payment payment) { try { credit.CreditId = payment.CreditId; credit.UserId = payment.UserId; var creditBalance = (creditCrud.Retrieve <Credit>(credit).Balance); if ((creditBalance - payment.Amount) >= 0) { crudPayment.Create(payment); } else { throw new Exception("El pago excede el saldo"); } } catch (Exception e) { throw new Exception(e.Message); } }
public Credit RetrieveById(Credit credit) { return(crudCredit.Retrieve <Credit>(credit)); }