예제 #1
0
        private tbl_Loan GetLoan(int ID)
        {
            var dbloan = new tbl_Loan();

            using (var dbContext = new LoanManagementSystemEntities())
            {
                dbloan = dbContext.tbl_Loan.Where(loan => loan.Id == ID).FirstOrDefault();
                return(dbloan);
            }
        }
예제 #2
0
        private void AssignValues(ref tbl_Loan Dbloan, ref LoanBusinessEntity loanBusinessEntity)
        {
            Dbloan.LoanNo              = loanBusinessEntity.LoanNo;
            Dbloan.LoanTypeId          = loanBusinessEntity.LoanTypeId;
            Dbloan.Nominee             = loanBusinessEntity.Nominee;
            Dbloan.NoOfInstallaments   = loanBusinessEntity.NoOfInstallments;
            Dbloan.interestrate        = (Double)loanBusinessEntity.intrestrate;
            Dbloan.NomineeRelationShip = loanBusinessEntity.NomineeRelationShip;
            Dbloan.CustomerId          = loanBusinessEntity.CustomerId;

            Dbloan.Amount = (decimal)loanBusinessEntity.Amount;
        }
예제 #3
0
        public bool Save(LoanBusinessEntity loanBusinessEntity)
        {
            tbl_Loan Dbloan;

            if (loanBusinessEntity.Id == -1)
            {
                Dbloan = new tbl_Loan();
            }
            else
            {
                Dbloan = GetLoan(loanBusinessEntity.Id);
            }
            AssignValues(ref Dbloan, ref loanBusinessEntity);
            using (var dbContext = new LoanManagementSystemEntities())
            {
                dbContext.tbl_Loan.Add(Dbloan);
                dbContext.SaveChanges();
            }


            return(true);
        }