Пример #1
0
        public ActionResult Create([Bind(Include = "Loan, MainWorkPlace")] IncomingLoan incomingLoan)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    IncomingLoanServices.Insert(CurrentUser.Id, incomingLoan, 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.LoanList          = new SelectList(LoanServices.List(db), "Product", "Name");
            ViewBag.MainWorkPlaceList = new SelectList(MainWorkPlaceServices.List(db), "Id", "Name");
            return(View(incomingLoan));
        }
Пример #2
0
        public ActionResult Edit([Bind(Include = "Loan, FromLoan")] LoanChange loanChange)
        {
            Db db = new Db(DbServices.ConnectionString);

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

            ViewBag.LoanList     = new SelectList(LoanServices.List(db), "Product", "Name", loanChange.Loan);
            ViewBag.FromLoanList = new SelectList(LoanServices.List(db), "Product", "Name", loanChange.FromLoan);
            return(View(loanChange));
        }
Пример #3
0
        public ActionResult Edit([Bind(Include = "Loan, LoanDecision, MainWorkPlace, ApprovedAmount, NetAmount, ProfitAmount")] OutgoingLoan outgoingLoan)
        {
            Db db = new Db(DbServices.ConnectionString);

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

            ViewBag.LoanList          = new SelectList(LoanServices.List(db), "Product", "Name", outgoingLoan.Loan);
            ViewBag.LoanDecisionList  = new SelectList(LoanDecisionServices.List(db), "Id", "CersNumber", outgoingLoan.LoanDecision);
            ViewBag.MainWorkPlaceList = new SelectList(MainWorkPlaceServices.List(db), "Id", "Name", outgoingLoan.MainWorkPlace);
            return(View(outgoingLoan));
        }
Пример #4
0
        public ActionResult Create()
        {
            Db db = new Db(DbServices.ConnectionString);

            ViewBag.LoanList          = new SelectList(LoanServices.List(db), "Product", "Name");
            ViewBag.MainWorkPlaceList = new SelectList(MainWorkPlaceServices.List(db), "Id", "Name");
            return(View());
        }
Пример #5
0
        // GET: IncomingLoan/Edit/5
        public ActionResult Edit(Nullable <int> loan)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (loan == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            IncomingLoan incomingLoan = IncomingLoanServices.Get(loan.Value, db);

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

            ViewBag.LoanList          = new SelectList(LoanServices.List(db), "Product", "Name", incomingLoan.Loan);
            ViewBag.MainWorkPlaceList = new SelectList(MainWorkPlaceServices.List(db), "Id", "Name", incomingLoan.MainWorkPlace);
            return(View(incomingLoan));
        }
Пример #6
0
        // GET: LoanChange/Edit/5
        public ActionResult Edit(Nullable <int> loan)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (loan == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LoanChange loanChange = LoanChangeServices.Get(loan.Value, db);

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

            ViewBag.LoanList     = new SelectList(LoanServices.List(db), "Product", "Name", loanChange.Loan);
            ViewBag.FromLoanList = new SelectList(LoanServices.List(db), "Product", "Name", loanChange.FromLoan);
            return(View(loanChange));
        }