public string CreateLoanRequest(LoanRequest loanRequest) { var account = (_quickLoanDbContext.Accounts .Include(item => item.OnlineUser) .Include(item => item.Branch)) .Where(item => item.OnlineUser.Id == loanRequest.UserId).FirstOrDefault(); var propMgr = new PropertyManager(); var loan = _quickLoanDbContext.LoanApplications.LastOrDefault(); var refNumber = account.Branch.BranchCode + "HL"; string sequenceNumber = "0000001"; if (loan != null) { sequenceNumber = "0000000" + loan.Id.ToString(); } refNumber += sequenceNumber.Substring(sequenceNumber.Length - 5); var receiver = _quickLoanDbContext.Users.Where(u => u.UserType == 1).FirstOrDefault(); var receiverBranch = _quickLoanDbContext.BankerOfficers .Include(bo => bo.Branch) .Include(bo => bo.OnlineUser) .Where(bo => bo.OnlineUser.Id == receiver.Id).FirstOrDefault(); var loanApplication = new Model.DbEntity.LoanApplication { Account = account, LoanOptions = GetLoanOptions(), Property = propMgr.GetPropertyDetail(loanRequest.Address), ReferenceNo = refNumber, CreatedDate = DateTime.UtcNow, AssignedTo = receiver, AssignedBranch = receiverBranch.Branch.Name, Status = "LU", Comments = "Yor are eligible for the loan." }; _quickLoanDbContext.LoanApplications.Add(loanApplication); _quickLoanDbContext.SaveChanges(); var femSettings = _configuration.GetSection("fcmSettings"); var serverKey = femSettings["userServerKey"]; var senderId = femSettings["userSenderID"]; var webUrl = femSettings["webAddress"]; var message = "We have received your request for eligibility check. Click here to view the eligibility details. Reference ID : " + refNumber; var notification = new NotificationManager(); notification.SendNotificationFromFirebaseCloud(webUrl, serverKey, senderId, account.OnlineUser.NotificationRegId, message); return(refNumber); }
public ResetCreditCardResponse Reset(CardResetRequest values) { ResetCreditCardResponse resetResponse = new ResetCreditCardResponse(); var member = _context.Members.Select(item => item).Where(item => item.Id == Convert.ToInt16(values.MemberId)).SingleOrDefault(); var account = _context.AccountDetails.Select(item => item).Where(item => item.MembersId == Convert.ToInt16(values.MemberId)); List <AccountDetails> accountDetails = new List <AccountDetails>(); accountDetails = account.ToList(); if (accountDetails.Count > 0) { var card = _context.Cards.Select(item => item).Where(item => item.AccountsId == accountDetails[0].AccountsId).ToList(); if (card.Count > 0) { card[0].PaymentDue = Convert.ToDecimal(values.Amount); _context.SaveChanges(); resetResponse.StatusMessage = "Reset successful for " + values.MemberId + " and with " + values.Amount; } else { resetResponse.StatusMessage = " card does not exist for given member id "; } } else { resetResponse.StatusMessage = " card does not exist for given member id "; } return(resetResponse); }
private static void InitialiseAccountsMster(QuickLoanDbContext context) { var accountEntries = new Accounts[] { new Accounts { AccountNumber = "5000", }, new Accounts { AccountNumber = "6000" }, new Accounts { AccountNumber = "7000" }, new Accounts { AccountNumber = "8000" } }; foreach (Accounts accountEntry in accountEntries) { context.Accounts.Add(accountEntry); } context.SaveChanges(); }
private static void IntialiseBanker(QuickLoanDbContext context) { var bankOfficers = new BankOfficer[] { new BankOfficer { FirstName = "ERIC", LastName = "JHON", Branch = new Branch { BranchCode = "BR0002", Name = "Branch 2" }, OnlineUser = new User { UserId = "eric", Password = "******", UserType = 1 } } }; foreach (BankOfficer bo in bankOfficers) { context.BankerOfficers.Add(bo); } context.SaveChanges(); }
private static void InitialiseLoansMster(QuickLoanDbContext context) { var loanDetailsEntries = new Loans[] { new Loans() { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "5000").ToList <Accounts>()[0].Id, LoanNumber = 0, Balance = 10000, EmiDue = 400, EmiDueDate = DateTime.Now.AddDays(3).ToString("MM/dd/yyyy"), Description = "Description" }, new Loans() { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "6000").ToList <Accounts>()[0].Id, LoanNumber = 1, Balance = 20000, EmiDue = 100, EmiDueDate = DateTime.Now.AddDays(4).ToString("MM/dd/yyyy"), Description = "Description" }, new Loans() { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "6000").ToList <Accounts>()[0].Id, LoanNumber = 3, Balance = 20000, EmiDue = 200, EmiDueDate = DateTime.Now.AddDays(1).ToString("MM/dd/yyyy"), Description = "Description" }, new Loans() { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "7000").ToList <Accounts>()[0].Id, LoanNumber = 3, Balance = 60000, EmiDue = 300, EmiDueDate = DateTime.Now.AddDays(2).ToString("MM/dd/yyyy"), Description = "Description" }, new Loans() { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "8000").ToList <Accounts>()[0].Id, LoanNumber = 3, Balance = 70000, EmiDue = 700, EmiDueDate = DateTime.Now.AddDays(2).ToString("MM/dd/yyyy"), Description = "Description" } }; foreach (Loans loanDetailsEntry in loanDetailsEntries) { context.Loans.Add(loanDetailsEntry); } context.SaveChanges(); }
public bool RegisterForNotification(RegisterationInfo registerationInfo) { try { var user = _context.Users.Select(item => item).Where(item => item.Id.ToString() == registerationInfo.UserId).FirstOrDefault(); user.NotificationRegId = registerationInfo.RegistrationId; _context.SaveChanges(); return(true); } catch { return(false); } }
private static void InitialiseShareMster(QuickLoanDbContext context) { var shareDetailsEntries = new Shares[] { new Shares() { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "5000").ToList <Accounts>()[0].Id, ShareNumber = 0, Balance = 10000, Description = "Description" }, new Shares() { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "6000").ToList <Accounts>()[0].Id, ShareNumber = 1, Balance = 20000, Description = "Description" }, new Shares() { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "6000").ToList <Accounts>()[0].Id, ShareNumber = 3, Balance = 30000, Description = "Description" }, new Shares() { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "7000").ToList <Accounts>()[0].Id, ShareNumber = 3, Balance = 40000, Description = "Description" }, new Shares() { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "8000").ToList <Accounts>()[0].Id, ShareNumber = 3, Balance = 50000, Description = "Description" } }; foreach (Shares shareDetailsEntry in shareDetailsEntries) { context.Shares.Add(shareDetailsEntry); } context.SaveChanges(); }
private static void InitialiseCards(QuickLoanDbContext context) { var cards = new Cards[] { new Cards() { CardNumber = "7890", AccountsId = 1, Type = "CREDIT", PaymentDueDate = "04/09/2018", PaymentDue = 100 }, new Cards() { CardNumber = "8942", AccountsId = 2, Type = "CREDIT", PaymentDueDate = "03/03/2018", PaymentDue = 200 }, new Cards() { CardNumber = "8945", AccountsId = 3, Type = "CREDIT", PaymentDueDate = "06/06/2018", PaymentDue = 90 }, new Cards() { CardNumber = "7842", AccountsId = 4, Type = "CREDIT", PaymentDueDate = "05/03/2019", PaymentDue = 50 } }; foreach (Cards card in cards) { context.Cards.Add(card); } context.SaveChanges(); }
private static void InitialiseAccount(QuickLoanDbContext context) { var accounts = new Account[] { new Account { FirstName = "BRENNA ANNA C", LastName = "MURPHY", Number = "8976890760", Addresses = new List <Address> { new Address { AddressType = "PERM", StreetAddress = "", City = "", State = "", Country = "", ZipCode = "" }, new Address { AddressType = "RESI", StreetAddress = "", City = "", State = "", Country = "", ZipCode = "" } }, Branch = new Branch { BranchCode = "BR0001", Name = "Branch 1" }, OnlineUser = new User { UserId = "amurphy", Password = "******", UserType = 3 } } }; foreach (Account account in accounts) { context.Accounts.Add(account); } context.SaveChanges(); }
private static void InitialiseMembersMster(QuickLoanDbContext context) { var memberEntries = new Members[] { new Members { MemberName = "Member1", LoanEligibility = 3000, LastLogin = "******", IsEditable = false, InUse = true }, new Members { MemberName = "Member2", LoanEligibility = 4000, LastLogin = "******", IsEditable = false, InUse = true }, new Members { MemberName = "Member3", LoanEligibility = 1000, LastLogin = "******", IsEditable = true, InUse = false }, new Members { MemberName = "Member4", LoanEligibility = 2000, LastLogin = "******", IsEditable = true, InUse = false } }; foreach (Members memberEntry in memberEntries) { context.Members.Add(memberEntry); } context.SaveChanges(); }
private static void InitialiseAccountMemberDetailsMster(QuickLoanDbContext context) { var accountDetailsEntries = new AccountDetails[] { new AccountDetails { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "5000").ToList <Accounts>()[0].Id, MembersId = context.Members.Select(item => item).Where(item => item.MemberName == "Member1").ToList <Members>()[0].Id, AccountTypesId = context.AccountTypes.Select(item => item).Where(item => item.Type == "Primary").ToList <AccountTypes>()[0].Id, }, new AccountDetails { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "6000").ToList <Accounts>()[0].Id, MembersId = context.Members.Select(item => item).Where(item => item.MemberName == "Member2").ToList <Members>()[0].Id, AccountTypesId = context.AccountTypes.Select(item => item).Where(item => item.Type == "Primary").ToList <AccountTypes>()[0].Id, }, new AccountDetails { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "6000").ToList <Accounts>()[0].Id, MembersId = context.Members.Select(item => item).Where(item => item.MemberName == "Member1").ToList <Members>()[0].Id, AccountTypesId = context.AccountTypes.Select(item => item).Where(item => item.Type == "Joint").ToList <AccountTypes>()[0].Id, }, new AccountDetails { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "7000").ToList <Accounts>()[0].Id, MembersId = context.Members.Select(item => item).Where(item => item.MemberName == "Member3").ToList <Members>()[0].Id, AccountTypesId = context.AccountTypes.Select(item => item).Where(item => item.Type == "Primary").ToList <AccountTypes>()[0].Id, }, new AccountDetails { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "8000").ToList <Accounts>()[0].Id, MembersId = context.Members.Select(item => item).Where(item => item.MemberName == "Member4").ToList <Members>()[0].Id, AccountTypesId = context.AccountTypes.Select(item => item).Where(item => item.Type == "Primary").ToList <AccountTypes>()[0].Id, } }; foreach (AccountDetails accountDetailsEntry in accountDetailsEntries) { context.AccountDetails.Add(accountDetailsEntry); } context.SaveChanges(); }
private static void InitialiseAccountTypeMster(QuickLoanDbContext context) { var accountTypeEntries = new AccountTypes[] { new AccountTypes { //Id=1, Type = "Primary" }, new AccountTypes { //Id=2, Type = "Joint" } }; foreach (AccountTypes accountTypeEntry in accountTypeEntries) { context.AccountTypes.Add(accountTypeEntry); } context.SaveChanges(); }
private static void InitialiseTransaction(QuickLoanDbContext context) { var transactions = new Transactions[] { new Transactions { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "5000").ToList <Accounts>()[0].Id, Description = "cash deposit", Type = "Share", RecordId = 0, Postdate = "01/09/2018", Amount = 300 }, new Transactions { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "5000").ToList <Accounts>()[0].Id, Description = "Loan advance", Type = "LOAN", RecordId = 0, Postdate = "02/08/2018", Amount = 700 }, new Transactions { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "5000").ToList <Accounts>()[0].Id, Description = "cash deposit", Type = "Share", RecordId = 0, Postdate = "03/09/2018", Amount = 300 }, new Transactions { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "5000").ToList <Accounts>()[0].Id, Description = "cash deposit", Type = "Share", RecordId = 0, Postdate = "04/09/2018", Amount = 200 }, new Transactions { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "5000").ToList <Accounts>()[0].Id, Description = "cash deposit", Type = "Share", RecordId = 0, Postdate = "05/09/2018", Amount = 700 }, //----------------------------------- new Transactions { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "6000").ToList <Accounts>()[0].Id, Description = "cash deposit", Type = "Share", RecordId = 1, Postdate = "01/09/2018", Amount = 300 }, new Transactions { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "6000").ToList <Accounts>()[0].Id, Description = "Loan advance", Type = "LOAN", RecordId = 1, Postdate = "02/08/2018", Amount = 700 }, new Transactions { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "6000").ToList <Accounts>()[0].Id, Description = "cash deposit", Type = "Share", RecordId = 3, Postdate = "03/09/2018", Amount = 300 }, new Transactions { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "6000").ToList <Accounts>()[0].Id, Description = "cash deposit", Type = "Share", RecordId = 1, Postdate = "04/09/2018", Amount = 200 }, new Transactions { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "6000").ToList <Accounts>()[0].Id, Description = "cash deposit", Type = "Share", RecordId = 3, Postdate = "05/09/2018", Amount = 700 }, //----------------------------------- new Transactions { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "7000").ToList <Accounts>()[0].Id, Description = "cash deposit", Type = "Share", RecordId = 3, Postdate = "02/09/2018", Amount = 300 }, new Transactions { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "7000").ToList <Accounts>()[0].Id, Description = "Loan advance", Type = "LOAN", RecordId = 3, Postdate = "02/18/2018", Amount = 700 }, new Transactions { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "7000").ToList <Accounts>()[0].Id, Description = "cash deposit", Type = "Share", RecordId = 3, Postdate = "03/20/2018", Amount = 300 }, new Transactions { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "7000").ToList <Accounts>()[0].Id, Description = "cash deposit", Type = "Share", RecordId = 3, Postdate = "04/09/2018", Amount = 200 }, new Transactions { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "7000").ToList <Accounts>()[0].Id, Description = "cash deposit", Type = "Share", RecordId = 3, Postdate = "06/09/2018", Amount = 700 }, //----------------------------------- new Transactions { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "8000").ToList <Accounts>()[0].Id, Description = "cash deposit", Type = "Share", RecordId = 3, Postdate = "02/09/2018", Amount = 500 }, new Transactions { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "8000").ToList <Accounts>()[0].Id, Description = "Loan advance", Type = "LOAN", RecordId = 3, Postdate = "02/18/2018", Amount = 900 }, new Transactions { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "8000").ToList <Accounts>()[0].Id, Description = "cash deposit", Type = "Share", RecordId = 3, Postdate = "03/20/2018", Amount = 390 }, new Transactions { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "8000").ToList <Accounts>()[0].Id, Description = "cash deposit", Type = "Share", RecordId = 3, Postdate = "04/09/2018", Amount = 200 }, new Transactions { AccountsId = context.Accounts.Select(item => item).Where(item => item.AccountNumber == "8000").ToList <Accounts>()[0].Id, Description = "cash deposit", Type = "Share", RecordId = 3, Postdate = "06/09/2018", Amount = 700 }, }; foreach (Transactions transaction in transactions) { context.Transactions.Add(transaction); } context.SaveChanges(); }
public RootObject GetAccountView(int memberId) { RootObject rootObject = new RootObject(); var member = _context.Members.Select(item => item).Where(item => item.Id == memberId).SingleOrDefault(); rootObject.MemberId = member.Id; rootObject.LastLogin = member.LastLogin; rootObject.MemberName = member.MemberName; rootObject.loanEligibility = member.LoanEligibility; member.LastLogin = DateTime.Now.ToString(); _context.SaveChanges(); rootObject.AccountView = new List <Portfolio>(); Portfolio accountView = null; var result = _context.AccountDetails.Select(item => item).Where(item => item.MembersId == memberId); if (result.Any()) { var resultList = result.ToList(); foreach (AccountDetails detail in resultList) { var primaryMemberId = _context.AccountDetails.Select(item => item).Where(item => item.AccountsId == detail.AccountsId && item.AccountTypesId == 1).SingleOrDefault().MembersId; var primaryMemberName = _context.Members.Select(item => item).Where(item => item.Id == primaryMemberId).SingleOrDefault().MemberName; var memberLoanEligibility = _context.Members.Select(item => item).Where(item => item.Id == primaryMemberId).SingleOrDefault().LoanEligibility; var jointMember = _context.AccountDetails.Select(item => item).Where(item => item.AccountsId == detail.AccountsId && item.AccountTypesId == 2).SingleOrDefault(); string jointMemberName = null; if (jointMember != null) { jointMemberName = _context.Members.Select(item => item).Where(item => item.Id == jointMember.MembersId).SingleOrDefault().MemberName; } var accountNumbers = _context.Accounts.Select(item => item).Where(item => item.Id == detail.AccountsId).ToList(); accountView = new Portfolio(); /* fixing response format */ // accountView.loanEligibility = memberLoanEligibility; accountView.account = accountNumbers[0].AccountNumber; accountView.Primary = primaryMemberName; accountView.Joint = jointMemberName; var shareList = _context.Shares.Select(item => item).Where(item => item.AccountsId == detail.AccountsId).ToList(); var loanList = _context.Loans.Select(item => item).Where(item => item.AccountsId == detail.AccountsId).ToList(); accountView.shares = new List <Share>(); accountView.loans = new List <Loan>(); foreach (Shares share in shareList) { accountView.shares.Add(new Share() { id = share.ShareNumber, balance = Convert.ToDouble(share.Balance), description = share.Description }); accountView.shares_total = accountView.shares_total + Convert.ToDouble(share.Balance); } foreach (Loans loan in loanList) { accountView.loans.Add(new Loan() { id = loan.Id, balance = Convert.ToDouble(loan.Balance), description = loan.Description, emiDue = loan.EmiDue, emiDueDate = loan.EmiDueDate }); accountView.loans_total = accountView.loans_total + Convert.ToDouble(loan.Balance); } /* get transactions */ accountView.transactionList = new List <TransactionList>(); accountView.transactionList = GetTransactions(accountNumbers[0].Id); /* get transactions */ /*get cards */ var cardDetails = _context.Cards.Select(item => item).Where(item => item.AccountsId == detail.AccountsId).ToList(); accountView.card = new Card(); accountView.card.Account = accountNumbers[0].AccountNumber; accountView.card.CardNumber = cardDetails[0].CardNumber; accountView.card.PaymentDue = cardDetails[0].PaymentDue; accountView.card.PaymentDueDate = cardDetails[0].PaymentDueDate; accountView.card.Type = cardDetails[0].Type; /*get cards*/ rootObject.AccountView.Add(accountView); accountView.message = accountView.shares.Count + " shares and " + accountView.loans.Count + " loans"; } } return(rootObject); }
public PaymentResponse CardPayment(CardPaymentRequest cardDetails) { var accountId = _context.Accounts.Select(item => item).Where(item => item.AccountNumber == cardDetails.AccountNumber.ToString()).SingleOrDefault(); var cCardDetails = _context.Cards.Select(item => item).Where(item => item.AccountsId == accountId.Id && item.CardNumber == cardDetails.CardNumber.ToString()).SingleOrDefault(); // var shareDetails = _context.Shares.Select(item => item).Where(item => item.AccountsId == accountId.Id).SingleOrDefault(); var shareDetails = _context.Shares.Select(item => item).Where(item => item.AccountsId == accountId.Id).ToList()[0]; Transactions transactions = null; if (shareDetails.Balance > Convert.ToDecimal(cardDetails.Amount)) { if (Convert.ToDecimal(cardDetails.Amount) < Convert.ToDecimal(cCardDetails.PaymentDue)) { // partial payment shareDetails.Balance = shareDetails.Balance - Convert.ToDecimal(cardDetails.Amount); _context.SaveChanges(); transactions = new Transactions(); transactions.Amount = Convert.ToDecimal(cardDetails.Amount); transactions.AccountsId = accountId.Id; transactions.Description = "card payment"; transactions.Postdate = DateTime.Today.ToString(); transactions.RecordId = 3; transactions.Type = "CARD"; _context.Add(transactions); _context.SaveChanges(); var cardPayment = _context.Cards.Select(item => item).Where(item => item.AccountsId == accountId.Id && item.CardNumber == cardDetails.CardNumber.ToString()).SingleOrDefault(); cardPayment.PaymentDue = cardPayment.PaymentDue - Convert.ToDecimal(cardDetails.Amount); _context.SaveChanges(); return(new PaymentResponse() { Status = true, Description = "Bill payment successful" }); } else { // Full payment transactions = new Transactions(); shareDetails.Balance = shareDetails.Balance - Convert.ToDecimal(cardDetails.Amount); //shareDetails.AccountsId = accountId.Id; //_context.Update(share); _context.SaveChanges(); transactions.Amount = Convert.ToDecimal(cardDetails.Amount); transactions.AccountsId = accountId.Id; transactions.Description = "card payment"; transactions.Postdate = DateTime.Today.ToString(); transactions.RecordId = 3; transactions.Type = "Card payment"; _context.Add(transactions); _context.SaveChanges(); var cardPayment = _context.Cards.Select(item => item).Where(item => item.AccountsId == accountId.Id && item.CardNumber == cardDetails.CardNumber.ToString()).SingleOrDefault(); cardPayment.PaymentDue = cardPayment.PaymentDue - Convert.ToDecimal(cardDetails.Amount); cardPayment.PaymentDueDate = DateTime.Today.AddMonths(1).ToString(); cardPayment.Type = "CREDIT"; _context.SaveChanges(); return(new PaymentResponse() { Status = true, Description = "Bill payment successful" }); } } else { return(new PaymentResponse() { Status = false, Description = "Share amount is less than payment amount" }); } }
private static void InitialiseLoanOptions(QuickLoanDbContext context) { var loanOptions = new List <LoanOptions> { new LoanOptions { Tenure = "5 Years", LoanAmount = 100000.00m, EMIAmount = 1887.22m, InterestRate = "5.00", LoanSchedule = new List <LoanSchedule>() { new LoanSchedule { TenureYear = "2018", PrincipalPaid = 8915.12m, InterestPaid = 2407.60m, Balance = 91084.88m }, new LoanSchedule { TenureYear = "2019", PrincipalPaid = 18511.59m, InterestPaid = 4133.85m, Balance = 72573.29m }, new LoanSchedule { TenureYear = "2020", PrincipalPaid = 19458.66m, InterestPaid = 3186.78m, Balance = 53114.63m }, new LoanSchedule { TenureYear = "2021", PrincipalPaid = 20454.23m, InterestPaid = 2191.21m, Balance = 32660.40m }, new LoanSchedule { TenureYear = "2022", PrincipalPaid = 21500.69m, InterestPaid = 1144.75m, Balance = 11159.71m }, new LoanSchedule { TenureYear = "2023", PrincipalPaid = 11159.71m, InterestPaid = 163.32m, Balance = 0 } } }, new LoanOptions { Tenure = "10 Years", LoanAmount = 100000.00m, EMIAmount = 1000.60m, InterestRate = "5.00", LoanSchedule = new List <LoanSchedule>() { new LoanSchedule { TenureYear = "2018", PrincipalPaid = 3904.43m, InterestPaid = 2459.53m, Balance = 96095.57m }, new LoanSchedule { TenureYear = "2019", PrincipalPaid = 8107.25m, InterestPaid = 4620.67m, Balance = 87988.32m }, new LoanSchedule { TenureYear = "2020", PrincipalPaid = 8522.03m, InterestPaid = 4205.89m, Balance = 79466.29m }, new LoanSchedule { TenureYear = "2021", PrincipalPaid = 8958.05m, InterestPaid = 3769.87m, Balance = 70508.24m }, new LoanSchedule { TenureYear = "2022", PrincipalPaid = 9416.36m, InterestPaid = 3311.56m, Balance = 61091.88m }, new LoanSchedule { TenureYear = "2023", PrincipalPaid = 9898.12m, InterestPaid = 2829.80m, Balance = 51193.76m }, new LoanSchedule { TenureYear = "2024", PrincipalPaid = 10404.51m, InterestPaid = 2323.41m, Balance = 40789.25m }, new LoanSchedule { TenureYear = "2025", PrincipalPaid = 10936.84m, InterestPaid = 1791.08m, Balance = 29852.41m }, new LoanSchedule { TenureYear = "2026", PrincipalPaid = 11496.39m, InterestPaid = 1231.53m, Balance = 18356.02m }, new LoanSchedule { TenureYear = "2027", PrincipalPaid = 12084.56m, InterestPaid = 643.36m, Balance = 6271.46m }, new LoanSchedule { TenureYear = "2028", PrincipalPaid = 6271.46m, InterestPaid = 91.77m, Balance = 0 } } }, new LoanOptions { Tenure = "15 Years", LoanAmount = 100000.00m, EMIAmount = 600.45m, InterestRate = "5.00", LoanSchedule = new List <LoanSchedule>() { new LoanSchedule { TenureYear = "2018", PrincipalPaid = 2268.25m, InterestPaid = 2476.49m, Balance = 97731.75m }, new LoanSchedule { TenureYear = "2019", PrincipalPaid = 4709.85m, InterestPaid = 4779.63m, Balance = 93021.90m }, new LoanSchedule { TenureYear = "2020", PrincipalPaid = 4950.83m, InterestPaid = 4538.65m, Balance = 88071.07m }, new LoanSchedule { TenureYear = "2021", PrincipalPaid = 5204.11m, InterestPaid = 4285.37m, Balance = 82866.96m }, new LoanSchedule { TenureYear = "2022", PrincipalPaid = 5470.37m, InterestPaid = 4019.11m, Balance = 77396.59m }, new LoanSchedule { TenureYear = "2023", PrincipalPaid = 5750.22m, InterestPaid = 3739.26m, Balance = 71646.37m }, new LoanSchedule { TenureYear = "2024", PrincipalPaid = 6044.40m, InterestPaid = 3445.08m, Balance = 65601.97m }, new LoanSchedule { TenureYear = "2025", PrincipalPaid = 6353.68m, InterestPaid = 3135.80m, Balance = 59248.29m }, new LoanSchedule { TenureYear = "2026", PrincipalPaid = 6678.74m, InterestPaid = 2810.74m, Balance = 52569.55m }, new LoanSchedule { TenureYear = "2027", PrincipalPaid = 7020.43m, InterestPaid = 2469.05m, Balance = 45549.12m }, new LoanSchedule { TenureYear = "2028", PrincipalPaid = 7379.62m, InterestPaid = 2109.86m, Balance = 38169.50m }, new LoanSchedule { TenureYear = "2029", PrincipalPaid = 7757.18m, InterestPaid = 1732.30m, Balance = 30412.32m }, new LoanSchedule { TenureYear = "2030", PrincipalPaid = 8154.04m, InterestPaid = 1335.44m, Balance = 22258.28m }, new LoanSchedule { TenureYear = "2031", PrincipalPaid = 8571.22m, InterestPaid = 918.26m, Balance = 13687.06m }, new LoanSchedule { TenureYear = "2032", PrincipalPaid = 9009.75m, InterestPaid = 479.73m, Balance = 4677.31m }, new LoanSchedule { TenureYear = "2033", PrincipalPaid = 4677.31m, InterestPaid = 68.47m, Balance = 0.00m } } } }; foreach (LoanOptions lo in loanOptions) { context.LoanOptions.Add(lo); } context.SaveChanges(); }