private async ValueTask <IEnumerable <Models.Note> > GetNotesByAuthor(Author.Types.Id authorId, ServerCallContext ctx) { if (authorId is null) { throw new ArgumentNullRpcException(nameof(authorId)); } var author = await _authors.GetById((int)authorId.Value, ctx.CancellationToken); if (!author.HasValue) { throw new InvalidArgumentRpcException($"The author with id {authorId.Value} could not be found"); } return(await _notes.GetByAuthor(author.Value, ctx.CancellationToken)); }
private async ValueTask <IEnumerable <Models.Author> > GetAuthorById(Author.Types.Id id, ServerCallContext ctx) { var result = await _authors.GetById((int)id.Value, ctx.CancellationToken); return(result.ToEnumerable()); }