public override Task <UsersInGroupListViewModel> GetUsersInGroupList( GetUsersInGroupViewModel request, ServerCallContext context) { var usersInGroupList = new UsersInGroupListViewModel { Users = { _users }, }; return(Task.FromResult(usersInGroupList)); }
public override async Task GetUsersInGroupStream( GetUsersInGroupViewModel request, IServerStreamWriter <UserInGroupViewModel> responseStream, ServerCallContext context) { foreach (var user in _users) { await Task.Delay(100); await responseStream.WriteAsync(user); } }
private static void GetUsersInGroupList(User.UserClient userServiceClient) { var getUsersInGroupViewModel = new GetUsersInGroupViewModel { GroupId = 1, }; var userList = userServiceClient.GetUsersInGroupList(getUsersInGroupViewModel); foreach (var user in userList.Users) { Console.WriteLine($"{user.Id} - {user.FirstName} {user.Surname} - {user.EmailAddress} - {user.Role}|{user.MembershipId}"); } }
private static async Task GetUsersInGroupStream(User.UserClient userServiceClient) { var getUsersInGroupViewModel = new GetUsersInGroupViewModel { GroupId = 1, }; using var call = userServiceClient.GetUsersInGroupStream(getUsersInGroupViewModel); while (await call.ResponseStream.MoveNext()) { var user = call.ResponseStream.Current; Console.WriteLine($"{user.Id} - {user.FirstName} {user.Surname} - {user.EmailAddress} - {user.Role}|{user.MembershipId}"); } }