public ActionResult editExceptionalAmount(ExceptionalAmount model)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    ExceptionalAmountServices.Update(CurrentUser.Id, model, db);
                    TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "UpdateConfirmed");
                    return(RedirectToAction("Details", new { id = model.LoanRequest }));
                }
                catch (CfException cfex)
                {
                    TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage;
                }
                catch (Exception ex)
                {
                    TempData["Failure"] = ex.Message;
                }
                return(RedirectToAction("Details", new { id = model.LoanRequest }));
            }

            ViewBag.ExceptionalAmountTypeList = new SelectList(ExceptionalAmountTypeServices.List(db), "Id", "Name", model.ExceptionalAmountType);

            ViewBag.ModuleName = moduleName;
            ViewBag.Action     = update;
            ViewBag.Update     = update;
            ViewBag.Save       = save;
            ViewBag.Back       = back;
            return(View("Details", new { id = model.LoanRequest }));
        }
        public ActionResult Create([Bind(Include = "Id, LoanRequest, SubNumber, Amount, Notes, ExceptionalAmountType")] ExceptionalAmount exceptionalAmount)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    ExceptionalAmountServices.Insert(CurrentUser.Id, exceptionalAmount, 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.ExceptionalAmountTypeList = new SelectList(ExceptionalAmountTypeServices.List(db), "Id", "Name");
            ViewBag.LoanRequestList           = new SelectList(LoanRequestServices.List(db), "Request", "Name");
            return(View(exceptionalAmount));
        }
        public ActionResult Create()
        {
            Db db = new Db(DbServices.ConnectionString);

            ViewBag.ExceptionalAmountTypeList = new SelectList(ExceptionalAmountTypeServices.List(db), "Id", "Name");
            ViewBag.LoanRequestList           = new SelectList(LoanRequestServices.List(db), "Request", "Name");
            return(View());
        }
        // GET: ExceptionalAmount/Edit/5
        public ActionResult Edit(Nullable <int> id)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ExceptionalAmount exceptionalAmount = ExceptionalAmountServices.Get(id.Value, db);

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

            ViewBag.ExceptionalAmountTypeList = new SelectList(ExceptionalAmountTypeServices.List(db), "Id", "Name", exceptionalAmount.ExceptionalAmountType);
            ViewBag.LoanRequestList           = new SelectList(LoanRequestServices.List(db), "Request", "Name", exceptionalAmount.LoanRequest);
            return(View(exceptionalAmount));
        }
        public ActionResult createExceptionalAmount(int?id, string Type)
        {
            try
            {
                Db db = new Db(DbServices.ConnectionString);

                if (id != null)
                {
                    ViewBag.LoanRequestId = id;
                }
                ViewBag.ExceptionalAmountTypeList = new SelectList(ExceptionalAmountTypeServices.List(db), "Id", "Name", Type);
                ViewBag.Type = Type;

                return(PartialView());
            }
            catch (CfException exc)
            {
            }
            catch (Exception exc)
            {
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult editExceptionalAmount(int?id)
        {
            ViewBag.ModuleName = moduleName;
            ViewBag.Action     = update;
            ViewBag.Update     = update;
            ViewBag.Save       = save;
            ViewBag.Back       = back;
            Db db = new Db(DbServices.ConnectionString);

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ExceptionalAmount exceptionalAmount = ExceptionalAmountServices.Get(id.Value, db);

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

            ViewBag.ExceptionalAmountTypeList = new SelectList(ExceptionalAmountTypeServices.List(db), "Id", "Name", exceptionalAmount.ExceptionalAmountType);

            return(PartialView(exceptionalAmount));
        }