public async Task <IActionResult> Add(Department model)
 {
     //判断model是否合法
     if (ModelState.IsValid)
     {
         await _departmentSevice.Add(model);
     }
     return(RedirectToAction(nameof(Index)));//添加完成 跳转到index页面
 }
        public async Task <IActionResult> OnPostAsync()
        {
            //验证model是否合法
            if (!ModelState.IsValid)
            {
                return(Page());                      //不合法返回当前页面
            }
            await _departmentSevice.Add(Department); //添加数据

            return(RedirectToPage("/Index"));        //返回根目录下的index页面,不加'/'返回当前目录下的index
        }