예제 #1
0
        public override Task <UsersInGroupListViewModel> GetUsersInGroupList(
            GetUsersInGroupViewModel request,
            ServerCallContext context)
        {
            var usersInGroupList = new UsersInGroupListViewModel
            {
                Users = { _users },
            };

            return(Task.FromResult(usersInGroupList));
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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}");
            }
        }
예제 #4
0
        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}");
            }
        }