コード例 #1
0
ファイル: Mutation.cs プロジェクト: mdekrey/GraphLinqQL
 public override IGraphQlObjectResult <Interfaces.Review?> CreateReview(Episode?episode, ReviewInput review)
 {
     if (episode == null)
     {
         throw new ArgumentNullException(nameof(episode));
     }
     return(this.ResolveTask(async _ =>
     {
         await Task.Yield();
         var ep = InterfaceToDomain.ConvertEpisode(episode.Value);
         var newReview = new Domain.Review {
             Episode = ep, Commentary = review.Commentary, Stars = review.Stars
         };
         Domain.Data.reviews[ep].Add(newReview);
         return newReview;
     }).AsContract <Review>());
 }
コード例 #2
0
        public override IGraphQlObjectResult <IEnumerable <Interfaces.Review?>?> Reviews(Interfaces.Episode episode)
        {
            var domainEpisode = InterfaceToDomain.ConvertEpisode(episode);

            return(this.Resolve(_ => Domain.Data.reviews[domainEpisode]).List(_ => _.AsContract <Review>()));
        }