public IActionResult Add(Department dept)
 {
     if (ModelState.IsValid)
     {
         _user.AddDept(dept);
         return(RedirectToAction(nameof(Add)));
     }
     else
     {
         return(View());
     }
 }
Beispiel #2
0
        /// <summary>
        /// 添加部门信息(包括学生信息)
        /// </summary>
        /// <param name="dept">部门信息</param>
        /// <returns></returns>
        public void AddDept(DepartmentInf dept)
        {
            int returnMessage = department.AddDept(dept);

            switch (returnMessage)
            {
            case -1: JScript.Alert("该学院编号存在");
                JScript.GoHistory(-1);
                break;

            case 1: JScript.AlertAndRedirect("添加成功!", "Default.aspx");
                break;

            case 0: JScript.Alert("添加失败,请重试!");
                JScript.GoHistory(-1);
                break;
            }
        }