/// <summary> /// 添加实体的扩展属性 /// </summary> /// <param name="item"></param> protected override void AppendExtention(User item) { item.Roles = userRoleManager.GetList(new UserRoleFilter { UserId = item.Id }).Select(p => roleManager.Get(p.RoleId)).Where(p => p != null).ToList(); IDepartmentManager departmentManager = serviceProvider.GetRequiredService <IDepartmentManager>(); ICollection <UserDepartment> userDepartments = userDepartmentManager.GetList(new UserDepartmentFilter { UserId = item.Id }); item.Departments = userDepartments.Select(p => departmentManager.Get(p.DepartmentId)).ToList(); }
public ActionResult Edit(int?id) { var vm = _departmentManager.Get(id); return(View(vm)); }