コード例 #1
0
        public ActionResult ShowDepartment()
        {
            BL_Department db = new BL_Department();

            return(new JsonResult {
                Data = db.SelectAllData(), JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
コード例 #2
0
        public JsonResult EditDepartment1(int id)
        {
            BL_Department db = new BL_Department();

            ModelState.Clear();

            return(new JsonResult {
                Data = db.GetDepartment(id), JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
            //  return View(db.GetDepartment(id));
        }
コード例 #3
0
 public ActionResult Department(Department obj, FormCollection dc)
 {
     try
     {
         BL_Department Bl_Dept = new BL_Department();
         if (Bl_Dept.CheckDepartment(obj.DepartmentID, obj.DepartmentName))
         {
             if (Bl_Dept.Save(obj))
             {
                 if (obj.DepartmentID > 0)
                 {
                     ModelState.Clear();
                     TempData["Msg"] = " Department  Updated Successfully";
                     return(RedirectToAction("Department", "Department"));
                 }
                 else
                 {
                     ModelState.Clear();
                     TempData["Msg"] = " Department Saved Successfully";
                     return(RedirectToAction("Department", "Department"));
                 }
             }
         }
         else
         {
             TempData["Msg"] = " Department Already Exist's";
             return(RedirectToAction("Department", "Department"));
         }
         return(RedirectToAction("Department", "Department"));
     }
     catch (Exception)
     {
         return(RedirectToAction("Department", "Department"));
     }
     return(RedirectToAction("Department", "Department"));
 }