Exemplo n.º 1
0
        public ActionResult Add(Loan collection)
        {
            using (LinkToDBDataContext context = new LinkToDBDataContext())
            {
                try
                {
                    Loan loan = new Loan();
                    loan.CreationDate = DateTime.Now;
                    loan.ModifyDate = DateTime.Now;
                    loan.Version = 1;
                    loan.UserId = 1;
                    loan.PaymentTypeId = 4;
                    loan.IsActive = true;

                    loan.Name = collection.Name;
                    loan.FirstPaymentDate = collection.FirstPaymentDate;
                    loan.LoanAmount = collection.LoanAmount;
                    loan.InterestRate = collection.InterestRate;
                    loan.Term = collection.Term;
                    loan.AddPayment = collection.AddPayment;
                    loan.Escrow = collection.Escrow;
                    loan.InterestCompDaily = false;
                    loan.InterestCompMonthly = true;

                    context.Loans.InsertOnSubmit(loan);
                    context.SubmitChanges();

                    return RedirectToAction("Index");
                }
                catch
                {
                    return View(collection);
                }
            }
        }
Exemplo n.º 2
0
 public DashboardItem(Loan loan)
 {
     Id = loan.Id;
     Name = loan.Name;
     Date = loan.DueDate;
     Amount = loan.MonthlyPayment;
     IsPastDue = loan.IsPastDue;
     IsShared = false;
     Type = "Loan";
     IsPaid = false;
 }
Exemplo n.º 3
0
        public ActionResult Edit(int id, Loan collection, string button)
        {
            ViewBag.Calculate = false;
            using (LinkToDBDataContext context = new LinkToDBDataContext())
            {
                Loan loan = context.GetLoan(id);

                try
                {
                    loan.ModifyDate = DateTime.Now;
                    loan.Version += 1;
                    loan.Name = collection.Name;
                    loan.FirstPaymentDate = collection.FirstPaymentDate;
                    loan.LoanAmount = collection.LoanAmount;
                    loan.InterestRate = collection.InterestRate;
                    loan.Term = collection.Term;
                    loan.AddPayment = collection.AddPayment;
                    loan.Escrow = collection.Escrow;

                    switch (button)
                    {
                        case "Calculate":
                            loan = loan.LoadLoan();
                            ViewBag.Calculate = true;
                            return View(loan);
                        case "Save":
                            context.SubmitChanges();
                            return RedirectToAction("Index");
                        default:
                            return View(loan);
                    }
                }
                catch
                {
                    return View(loan);
                }
            }
        }
Exemplo n.º 4
0
 partial void UpdateLoan(Loan instance);
Exemplo n.º 5
0
 partial void DeleteLoan(Loan instance);
Exemplo n.º 6
0
 partial void InsertLoan(Loan instance);
Exemplo n.º 7
0
		private void detach_Loans(Loan entity)
		{
			this.SendPropertyChanging();
			entity.User = null;
		}
Exemplo n.º 8
0
		private void attach_Loans(Loan entity)
		{
			this.SendPropertyChanging();
			entity.User = this;
		}
Exemplo n.º 9
0
		private void detach_Loans(Loan entity)
		{
			this.SendPropertyChanging();
			entity.PaymentType = null;
		}
Exemplo n.º 10
0
		private void attach_Loans(Loan entity)
		{
			this.SendPropertyChanging();
			entity.PaymentType = this;
		}