コード例 #1
0
        /// <summary>Gets the user list asynchronous.</summary>
        /// <returns></returns>
        public async Task <List <AppUser> > GetUserListAsync()
        {
            var Users = await AppUsers
                        .Include(b => b.AppUserRole)
                        .ThenInclude(x => x.Role).ToListAsync();

            return(Users);
        }
コード例 #2
0
        /// <summary>Gets the user with posts asynchronous.</summary>
        /// <param name="id">The identifier.</param>
        /// <returns></returns>
        public async Task <IEnumerable <Post> > GetUserWithPostsAsync(int?id)
        {
            var User = await AppUsers
                       .Include(b => b.Posts)
                       .FirstOrDefaultAsync(m => m.Id == id);

            return(User.Posts);
        }
コード例 #3
0
        /// <summary>Gets the user by identifier with roles asynchronous.</summary>
        /// <param name="id">The identifier.</param>
        /// <returns></returns>
        public async Task <AppUser> GetUserByIdWithRolesAsync(int?id)
        {
            var User = await AppUsers
                       .Include(b => b.AppUserRole)
                       .ThenInclude(x => x.Role)
                       .FirstOrDefaultAsync(m => m.Id == id);

            return(User);
        }