示例#1
0
        public ActionResult Create([Bind(Include = "Employee, SalaryAmount, TransferMonth, FinishedInstallmentsAmount, RemainingInstallmentsAmount, Notes")] MissingInstallmentDecrease missingInstallmentDecrease)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (ModelState.IsValid)
            {
                try
                {
                    MissingInstallmentDecreaseServices.Insert(CurrentUser.Id, missingInstallmentDecrease, 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");
            return(View(missingInstallmentDecrease));
        }
示例#2
0
        // GET: MissingInstallmentDecrease/Delete/5
        public ActionResult Delete(Nullable <int> id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Db db = new Db(DbServices.ConnectionString);
            MissingInstallmentDecrease missingInstallmentDecrease = MissingInstallmentDecreaseServices.Get(id.Value, db);

            if (missingInstallmentDecrease == null)
            {
                return(HttpNotFound());
            }
            return(View(missingInstallmentDecrease));
        }
示例#3
0
        // GET: MissingInstallmentDecrease/Edit/5
        public ActionResult Edit(Nullable <int> employee)
        {
            Db db = new Db(DbServices.ConnectionString);

            if (employee == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MissingInstallmentDecrease missingInstallmentDecrease = MissingInstallmentDecreaseServices.Get(employee.Value, db);

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

            ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName", missingInstallmentDecrease.Employee);
            return(View(missingInstallmentDecrease));
        }