コード例 #1
0
ファイル: TextService.cs プロジェクト: Cartmanidze/TextApp
        public override async Task <SaveTextResponse> SaveTextAsString(SaveTextAsStringRequest request, ServerCallContext context)
        {
            var body = request.Body;
            await _textFileRepository.InsertAsync(new TextFile { Body = body });

            return(new SaveTextResponse {
                Result = true
            });
        }
コード例 #2
0
        public override async Task <SaveTextResponse> SaveTextAsString(SaveTextAsStringRequest request, ServerCallContext context)
        {
            _logger.LogInformation("Begin grpc call from method {Method} for save text as string", context.Method);
            var body = request.Body;
            await _textRepository.CreateAsync(new Text { Value = body }, context.CancellationToken);

            await _textRepository.SaveAsync(context.CancellationToken);

            context.Status = new Status(StatusCode.OK, "Save text as string complete");
            return(new SaveTextResponse {
                Result = true
            });
        }