public async Task <IList <RoleTypeViewResponse> > GetRoleTypeList() { IList <RoleTypeViewResponse> roleTypeViews = new List <RoleTypeViewResponse>(); var roleList = await _roleRespository.EntitiesByExpressionAsync(r => r.IsDelete == false, r => new RoleQueryDto { Name = r.Name, Id = r.Id, RoleType = (RoleType)r.RoleType }); var roleTypeList = EnumExtension.GetEnumList <RoleType>(); foreach (var item in roleTypeList) { roleTypeViews.Add(new RoleTypeViewResponse() { Id = item.Id, Name = item.Name, RoleList = roleList.Where(r => r.RoleType == ((RoleType)item.Id)).ToList() }); } return(roleTypeViews); }
/// <summary> /// 根据枚举名称获取枚举列表 /// </summary> /// <param name="name">枚举名称不区分大小写</param> /// <returns></returns> public dynamic Get(string name) { return(new { status = 0, result = EnumExtension.GetEnumList(name) }); }