Exemplo n.º 1
0
 public static LoansDto ConvertToDto(LoanSupportRequest loan)
 {
     if (loan == null)
     {
         return(null);
     }
     return(new LoansDto()
     {
         Details = loan.Details,
         AmountRequested = loan.AmountRequested,
         AmountRepaymentMonthly = loan.AmountRepaymentMonthly,
         branch = loan.branch,
         ApprovedAmount = loan.ApprovedAmount,
         CurrentStatus = loan.CurrentStatus,
         Date = loan.Date,
         DateReturningEntireAmount = loan.DateReturningEntireAmount,
         DigitalSignature = loan.DigitalSignature,
         Id = loan.Id,
         IsApproved = loan.IsApproved,
         Iscanceled = loan.Iscanceled,
         IsDisapprovedClosedRequest = loan.IsDisapprovedClosedRequest,
         LoanGuarantors = loan.LoanGuarantors,
         NumberApprovedMonths = loan.NumberApprovedMonths,
         ReasonIsApproved = loan.ReasonIsApproved,
         Student = loan.Student
     });
 }
Exemplo n.º 2
0
        public int InsertLoan(LoanSupportRequest loan)
        {
            IList <DbParameter> parameters = new List <DbParameter>()
            {
                //new MySqlParameter("@account_number",student.AccountNumber!=null?student.AccountNumber:null),
                //new MySqlParameter("@first_name",student.FirstName),
                //new MySqlParameter("@last_name",student.LastName),
                //new MySqlParameter("@address_id",student.Address.Id),
                //new MySqlParameter("@bank_id", student.Bank.Id),
                //new MySqlParameter("@born_date", student.BornDate),
                //new MySqlParameter("@cellphone_number", student.CellphoneNumber!=null?student.CellphoneNumber:null),
                //new MySqlParameter("@children_number", student.ChildrenNumber!=null?student.ChildrenNumber:null),
                //new MySqlParameter("@fax_number", student.FaxNumber!=null?student.FaxNumber:null),
                //new MySqlParameter("@id_card", student.IdCard),
                //new MySqlParameter("@identity_number", student.IdentityNumber),
                //new MySqlParameter("@image", student.Image),
                //new MySqlParameter("@job_wife", student.JobWife!=null?student.JobWife:null),
                //new MySqlParameter("@married_children_number",student.MarriedChildrenNumber!=null?student.MarriedChildrenNumber:null),
                //new MySqlParameter("@monthly_income", student.MonthlyIncome!=null?student.MonthlyIncome:null),
                //new MySqlParameter("@travel_expenses", student.TravelExpenses!=null?student.TravelExpenses:null),
                //new MySqlParameter("@wife_name", student.WifeName!=null?student.WifeName:null),
                //new MySqlParameter("@phone_number", student.PhoneNumber),
                //new MySqlParameter("@travel_expenses_currency",student.TravelExpensesCurrency!=null?student.TravelExpensesCurrency:null),
                //new MySqlParameter("@monthly_income_currency",student.MonthlyIncomeCurrency!=null?student.MonthlyIncomeCurrency:null),
                //new MySqlParameter("@is_active", student.IsActive)
            };

            return(_dbContext.Insert(Tables.Students.InsertTable, true, parameters));
        }
Exemplo n.º 3
0
 public static int InsertLoan(LoanSupportRequest loan)
 {
     try
     {
         using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
         {
             int insert = LoanDataManager.InsertLoan(loan);
             scope.Complete();
             return(insert);
         }
     }
     catch (Exception ex)
     {
         _logger.Debug($"Failed to insert pending student.", ex);
         throw;
     }
 }
Exemplo n.º 4
0
 public HttpResponseMessage InsertLoans([FromBody] LoansDto loanDto)
 {
     try
     {
         LoanSupportRequest loan = Converters.Convert(loanDto);
         if (!ValidateModel.IsValid(new List <object>()
         {
             loan
         }))
         {
             return(Request.CreateResponse(HttpStatusCode.BadRequest, ValidateModel.ModelsResults));
         }
         LoanManager.InsertLoan(loan);
         return(Request.CreateResponse(HttpStatusCode.OK, loan.Id));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, $"Failed to insert the loan, {ex.Message}"));
     }
 }