/// <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); }
/// <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); }
/// <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); }