public ActionResult Edit(int id, FormCollection collection) { try { // TODO: Add update logic here var model = JobPost.GetById(id); var dept = model.Department; TryUpdateModel(model); if (model.DepartmentSID > 0 && model.DepartmentSID != dept.id) { model.Department = AdminDepartment.GetById(model.DepartmentSID); } model.CreatedAt = DateTime.Now; if (SessionItems.CurrentUser == null || SessionItems.CurrentUser.UserID <= 0) { model.CreatedBy = 1; } else { model.CreatedBy = SessionItems.CurrentUser.UserID; } model.SaveOrUpDate(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(int id, FormCollection collection) { try { // TODO: Add update logic here var model = AdminDepartment.GetById(id); var company = model.ParentID; TryUpdateModel(model); if (model.ParentSID > 0) { model.ParentID = Company.GetById(model.ParentSID); } else { model.ParentID = company; } model.SaveOrUpDate(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(FormCollection collection) { try { // TODO: Add insert logic here var model = new JobPost(); TryUpdateModel(model); if (model.DepartmentSID > 0) { model.Department = AdminDepartment.GetById(model.DepartmentSID); } model.CreatedAt = DateTime.Now; if (SessionItems.CurrentUser == null || SessionItems.CurrentUser.UserID <= 0) { model.CreatedBy = 1; } else { model.CreatedBy = SessionItems.CurrentUser.UserID; } model.Insert(); return(RedirectToAction("Index")); } catch { return(View()); } }
public AdminDepartmentModel(AdminDepartment entity) { Id = entity.Id; CanonicalName = entity.CanonicalName; DisplayName = entity.DisplayName; Abbreviation = entity.Abbreviation; SubDepartments = Construct(entity.SubDepartments); }
public ActionResult Create(FormCollection collection) { try { // TODO: Add insert logic here var model = new AdminDepartment(); TryUpdateModel(model); if (model.ParentSID > 0) { model.ParentID = Company.GetById(model.ParentSID); } else { return(View()); } model.Insert(); return(RedirectToAction("Index")); } catch { return(View()); } }
// GET: AdminDepartment/Edit/5 public ActionResult Edit(int id) { return(View(AdminDepartment.GetById(id))); }
// GET: AdminDepartment public ActionResult Index() { return(View(AdminDepartment.GetAll())); }