public ActionResult Create([Bind(Include = "Id, Name, SalaryWorkPlace")] Department department) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { DepartmentServices.Insert(CurrentUser.Id, department, 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.SalaryWorkPlaceList = new SelectList(SalaryWorkPlaceServices.List(db), "Id", "Name"); return(View(department)); }
public ActionResult Create() { Db db = new Db(DbServices.ConnectionString); ViewBag.SalaryWorkPlaceList = new SelectList(SalaryWorkPlaceServices.List(db), "Id", "Name"); return(View()); }
/// <summary> /// Returns a list of CashPaymentVw objects /// </summary> /// <returns></returns> public ActionResult Index(CashPaymentVwViewModel Model) { Db db = new Db(DbServices.ConnectionString); ViewBag.PaymentEmployeeDepartmentSalaryWorkPlaceId = new SelectList(SalaryWorkPlaceServices.List(db), "Id", "Name"); if (Model.Filter.HasCriteria) { Model.List = CashPaymentVwServices.Get(Model.Filter, db); } else { Model.List = new List <CashPaymentVw>(); } return(View(Model)); }
// GET: Department/Edit/5 public ActionResult Edit(Nullable <int> id) { Db db = new Db(DbServices.ConnectionString); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Department department = DepartmentServices.Get(id.Value, db); if (department == null) { return(HttpNotFound()); } ViewBag.SalaryWorkPlaceList = new SelectList(SalaryWorkPlaceServices.List(db), "Id", "Name", department.SalaryWorkPlace); return(View(department)); }