public IActionResult Add(DepartmentDto model) { if (ModelState.IsValid) { model.CreateTime = DateTime.Now.ToString(); model.CreateUser = HttpContext.Session.GetString("CurrentUser"); //添加到数据库 _departmentAppService.AddDto(model); //重定向 return(RedirectToAction("Index", "Department")); } return(View(model)); }