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));
        }
        public ActionResult Create()
        {
            Db db = new Db(DbServices.ConnectionString);

            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());
        }
        // GET: InsuranceType/Delete/5
        public ActionResult Delete(Nullable <byte> id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Db            db            = new Db(DbServices.ConnectionString);
            InsuranceType insuranceType = InsuranceTypeServices.Get(id.Value, db);

            if (insuranceType == null)
            {
                return(HttpNotFound());
            }
            return(View(insuranceType));
        }
 public ActionResult DeleteConfirmed(byte id)
 {
     try
     {
         Db db = new Db(DbServices.ConnectionString);
         InsuranceTypeServices.Delete(CurrentUser.Id, id, db);
         TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "DeleteConfirmed");
         // return RedirectToAction("Index");
     }
     catch (CfException cfex)
     {
         TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage;
     }
     catch (Exception ex)
     {
         TempData["Failure"] = ex.Message;
     }
     // return View(insuranceType);
     return(RedirectToAction("Index"));
 }
        // 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));
        }
        public ActionResult Create([Bind(Include = "Id, Name")] InsuranceType insuranceType)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    InsuranceTypeServices.Insert(CurrentUser.Id, insuranceType, 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;
                }
            }

            return(View(insuranceType));
        }