public static bool SaveDepartmentForm(DepartmentManagerFormModel model)
        {
            bool success = false;

            spiffaiwebEntities db = LoadDB();
            try
            {
                var department = new Department();
                department.DepartmentName = model.DepartmentName;
                department.DepartmentEmail = model.DepartmentEmail;
                department.IsDelete = model.IsActive;

                if (model.DepartmentId > 0)
                {
                    //Edit
                    department.DepartmentId = model.DepartmentId;
                    db.Entry(department).State = EntityState.Modified;
                    db.SaveChanges();
                    success = true;
                }
                else
                {
                    //Create
                    db.Departments.Add(department);
                    db.SaveChanges();
                    success = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return success;
        }
 public ActionResult SaveDepartmentManagerForm(DepartmentManagerFormModel model)
 {
     //Action to Add/Update Poll Configuration
     if (ModelState.IsValid)
     {
         var response = Data.AdminDashboard.DepartmentManagerUoW.SaveDepartmentForm(model);
         return Json(new { Success = true });
     }
     return Json(new { Success = false });
 }
        public ActionResult DepartmentManagerForm(int departmentId)
        {
            var model = new DepartmentManagerFormModel();
            model.DepartmentId = departmentId;
            if (departmentId > 0)
            {
                model = Data.AdminDashboard.DepartmentManagerUoW.GetConfigurationForm(departmentId);
            }

            return PartialView("_DepartmentManagerForm", model);
        }
        public static DepartmentManagerFormModel GetConfigurationForm(int departmentId)
        {
            var result = new DepartmentManagerFormModel();

            spiffaiwebEntities db = LoadDB();
            var form = (from d in db.Departments where d.DepartmentId == departmentId select d).FirstOrDefault();

            result.DepartmentId = departmentId;
            result.DepartmentName = form.DepartmentName;
            result.DepartmentEmail = form.DepartmentEmail;
            result.IsActive = form.IsDelete;

            return result;
        }