public ActionResult Create()
        {
            Db db = new Db(DbServices.ConnectionString);

            ViewBag.GuarantorList = new SelectList(GuarantorServices.List(db), "Id", "Notes");
            return(View());
        }
        public ActionResult Create([Bind(Include = "Guarantor, GrossSalary, DeductionsAmount, NetSalary, ExceptionalIncome")] GuarantorStatement guarantorStatement)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    GuarantorStatementServices.Insert(CurrentUser.Id, guarantorStatement, 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.GuarantorList = new SelectList(GuarantorServices.List(db), "Id", "Notes");
            return(View(guarantorStatement));
        }
        // GET: GuarantorStatement/Edit/5
        public ActionResult Edit(Nullable <int> guarantor)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (guarantor == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GuarantorStatement guarantorStatement = GuarantorStatementServices.Get(guarantor.Value, db);

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

            ViewBag.GuarantorList = new SelectList(GuarantorServices.List(db), "Id", "Notes", guarantorStatement.Guarantor);
            return(View(guarantorStatement));
        }