Exemplo n.º 1
0
        /// <summary>
        /// 获取所有角色。
        /// </summary>
        /// <returns>所有角色。</returns>
        public RoleDataObjectList GetRoles()
        {
            var roles = roleRepository.FindAll();
            RoleDataObjectList result = null;

            if (roles != null &&
                roles.Count() > 0)
            {
                result = new RoleDataObjectList();
                roles.ToList()
                .ForEach(r => result.Add(Mapper.Map <Role, RoleDataObject>(r)));
            }
            return(result);
        }
        /// <summary>
        /// 获取所有角色。
        /// </summary>
        /// <returns>所有角色。</returns>
        public RoleDataObjectList GetRoles()
        {
            var roles = _roleRepository.FindAll();
            RoleDataObjectList result = null;
            var eRoles = roles as IList <Role> ?? roles.ToList();

            if (roles != null &&
                eRoles.Any())
            {
                result = new RoleDataObjectList();
                eRoles.ToList()
                .ForEach(r => result.Add(Mapper.Map <Role, RoleDataObject>(r)));
            }
            return(result);
        }
Exemplo n.º 3
0
 /// <summary>
 /// 获取所有角色。
 /// </summary>
 /// <returns>所有角色。</returns>
 public RoleDataObjectList GetRoles()
 {
     var roles = roleRepository.FindAll();
     RoleDataObjectList result = null;
     if (roles != null &&
         roles.Count() > 0)
     {
         result = new RoleDataObjectList();
         roles.ToList()
             .ForEach(r => result.Add(Mapper.Map<Role, RoleDataObject>(r)));
     }
     return result;
 }
 /// <summary>
 /// 获取所有角色。
 /// </summary>
 /// <returns>所有角色。</returns>
 public RoleDataObjectList GetRoles()
 {
     var roles = _roleRepository.FindAll();
     RoleDataObjectList result = null;
     var eRoles = roles as IList<Role> ?? roles.ToList();
     if (roles != null &&
         eRoles.Any())
     {
         result = new RoleDataObjectList();
         eRoles.ToList()
             .ForEach(r => result.Add(Mapper.Map<Role, RoleDataObject>(r)));
     }
     return result;
 }