Exemplo n.º 1
0
        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());
            }
        }
Exemplo n.º 2
0
 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());
     }
 }
Exemplo n.º 3
0
 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());
     }
 }
Exemplo n.º 4
0
 // GET: AdminDepartment/Edit/5
 public ActionResult Edit(int id)
 {
     return(View(AdminDepartment.GetById(id)));
 }