Exemplo n.º 1
0
 public CreditModel(Credit credit, bool takePayments = true)
 {
     Id = credit.Id;
     StartDate = credit.StartDate;
     EndDate = credit.EndDate;
     StartAmount = credit.StartAmount;
     MainDebt = credit.MainDebt;
     PercentageDebt = credit.PercentageDebt;
     CreditTypeId = credit.CreditTypeId;
     ClientId = credit.ClientId;
     if (credit.CreditType != null)
     {
         CreditType = new CreditTypeModel(credit.CreditType);
     }
     if (credit.UserProfile != null)
     {
         Client = new UserViewModel(credit.UserProfile);
     }
     if (takePayments && credit.CreditPayment != null)
     {
         PaymentModels =
             credit.CreditPayment.Select(item => new CreditPaymentModel(item))
                 .OrderByDescending(item => item.Date)
                 .ToList();
     }
 }
Exemplo n.º 2
0
 public DepositModel(Deposit deposit, bool takePayments = true)
 {
     Id = deposit.Id;
     StartDate = deposit.StartDate;
     Balance = deposit.Balance;
     DepositTypeId = deposit.DepositTypeId;
     RequestId = deposit.RequestId;
     EndDate = deposit.EndDate;
     ClientId = deposit.ClientId;
     if (deposit.DepositType != null)
     {
         DepositType = new DepositTypeModel(deposit.DepositType);
     }
     if (deposit.UserProfile != null)
     {
         ClientModel = new UserViewModel(deposit.UserProfile);
     }
     if (takePayments && deposit.DepositPayment != null)
     {
         PaymentModels =
             deposit.DepositPayment.Select(item => new DepositPaymentModel(item))
                 .OrderByDescending(item => item.Date)
                 .ToList();
     }
 }