public ActionResult Create([Bind(Include = "Id, Employee, PaymentDate, PaymentAmount, PaymentNotes, InvoiceDate, InvoiceAmount, InvoiceNotes, InsuranceDate, InsuranceAmount, InsuranceType, InsuranceNotes, BoardDate, BoardAmount, BoardType, BoardNotes, DirectPaymentDate, DirectPaymentAmount, DirectPaymentNotes, PaymentStatus, Notes, Department, HealthLoanDecision, RequestCost, LoanRequest")] HealthLoanDecisionFirstPayment healthLoanDecisionFirstPayment)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    HealthLoanDecisionFirstPaymentServices.Insert(CurrentUser.Id, healthLoanDecisionFirstPayment, db);
                    TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed");
                    return(RedirectToAction("Index"));
                }
                catch (CfException cfex)
                {
                    TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage;
                }
                catch (Exception ex)
                {
                    TempData["Failure"] = ex.Message;
                }
            }

            ViewBag.EmployeeList           = new SelectList(EmployeeServices.List(db), "Id", "FirstName");
            ViewBag.HealthLoanDecisionList = new SelectList(HealthLoanDecisionServices.List(db), "Id", "CersNumber");
            ViewBag.InsuranceTypeList      = new SelectList(InsuranceTypeServices.List(db), "Id", "Name");
            return(View(healthLoanDecisionFirstPayment));
        }
        // GET: HealthLoanDecisionFirstPayment/Delete/5
        public ActionResult Delete(Nullable <int> id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Db db = new Db(DbServices.ConnectionString);
            HealthLoanDecisionFirstPayment healthLoanDecisionFirstPayment = HealthLoanDecisionFirstPaymentServices.Get(id.Value, db);

            if (healthLoanDecisionFirstPayment == null)
            {
                return(HttpNotFound());
            }
            return(View(healthLoanDecisionFirstPayment));
        }
        // GET: HealthLoanDecisionFirstPayment/Edit/5
        public ActionResult Edit(Nullable <int> id)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HealthLoanDecisionFirstPayment healthLoanDecisionFirstPayment = HealthLoanDecisionFirstPaymentServices.Get(id.Value, db);

            if (healthLoanDecisionFirstPayment == null)
            {
                return(HttpNotFound());
            }

            ViewBag.EmployeeList           = new SelectList(EmployeeServices.List(db), "Id", "FirstName", healthLoanDecisionFirstPayment.Employee);
            ViewBag.HealthLoanDecisionList = new SelectList(HealthLoanDecisionServices.List(db), "Id", "CersNumber", healthLoanDecisionFirstPayment.HealthLoanDecision);
            ViewBag.InsuranceTypeList      = new SelectList(InsuranceTypeServices.List(db), "Id", "Name", healthLoanDecisionFirstPayment.InsuranceType);
            return(View(healthLoanDecisionFirstPayment));
        }