コード例 #1
0
        public override async Task GetAll(Empty request, IServerStreamWriter <Author> responseStream, ServerCallContext context)
        {
            var authors = await this.blogService.GetAllAuthorsAsync();

            foreach (var author in authors)
            {
                await responseStream.WriteAsync(EntityToDtoMapper.MapAuthor(author));

                Thread.Sleep(5000);
            }
        }
コード例 #2
0
        public override async Task <Author> AddAuthor(Author request, ServerCallContext context)
        {
            var author = await this.blogService.AddAuthorAsync(DtoToEntityMapper.MapAuthor(request));

            return(EntityToDtoMapper.MapAuthor(author));
        }
コード例 #3
0
 public override async Task <Author> GetAuthorById(Int32Value request, ServerCallContext context)
 {
     return(EntityToDtoMapper.MapAuthor(await this.blogService.GetAuthorByIdAsync(request.Value)));
 }