コード例 #1
0
        public JsonResult Delete(string deptIds, string reason)
        {
            bool successStatus = false;

            try
            {
                successStatus = new SubDepartmentFacade().Delete(deptIds, reason);
            }
            catch (Exception ex)
            {
                return(this.Json("{\"Error\": \"" + ex.Message + "\"}"));
            }
            string jsonResult = "{\"Success\": \"" + successStatus.ToString() + "\"}";

            return(this.Json(jsonResult));
        }
コード例 #2
0
        public JsonResult Save(SubDepartmentModel model)
        {
            int newDeptId = 0;

            try
            {
                if (ModelState.IsValid)
                {
                    if (model.DepartmentID == 0)
                    {
                        throw new ApplicationException("Please create department before creating sub departments.");
                    }
                    newDeptId = new SubDepartmentFacade().CreateOrModify(model);
                }
            }
            catch (Exception ex)
            {
                return(this.Json("{\"Error\": \"" + ex.Message + "\"}"));
            }
            string jsonResult = "{\"ID\":\"" + newDeptId + "\",\"Name\": \"" + model.SubDepartmentName + "\"}";

            return(this.Json(jsonResult));
        }