public override async Task <TextAllResponse> GetTextsAll(TextAllRequest request, ServerCallContext context) { _logger.LogInformation("Begin grpc call from method {Method} for all texts", context.Method); var allTexts = await _textRepository.GetAsync(); if (allTexts.Length > 0) { var response = new TextAllResponse(); foreach (var text in allTexts) { response.Items.Add(new TextItemResponse { Id = text.Oid.ToString(), Body = text.Value }); } context.Status = new Status(StatusCode.OK, "All texts received"); return(response); } return(null); }
public Task <DetailedText> GetAsync(int userId, int textId) { return(_textRepository.GetAsync(userId, textId)); }