Esempio n. 1
0
        /// <summary>
        /// Creates a review for a given Star Wars episode.
        /// </summary>
        public async Task <CreateReviewPayload> CreateReview(
            CreateReviewInput input,
            [Service] IReviewRepository repository,
            [Service] IEventSender eventSender)
        {
            var review = new Review(input.Stars, input.Commentary);

            repository.AddReview(input.Episode, review);
            await eventSender.SendAsync(new OnReviewMessage(input.Episode, review));

            return(new CreateReviewPayload(input.Episode, review));
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a review for a given Star Wars episode.
        /// </summary>
        public async Task <CreateReviewPayload> CreateReview(
            CreateReviewInput input,
            [Service] IReviewRepository repository,
            [Service] ITopicEventSender eventSender)
        {
            var review = new Review(input.Stars, input.Commentary);

            repository.AddReview(input.Episode, review);
            await eventSender
            .SendAsync(input.Episode, review)
            .ConfigureAwait(false);

            return(new CreateReviewPayload(input.Episode, review));
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a review for a given Star Wars episode.
        /// </summary>
#pragma warning disable CS1998                     // Async method lacks 'await' operators and will run synchronously
        public async Task <CreateReviewPayload> CreateReview(
#pragma warning restore CS1998                     // Async method lacks 'await' operators and will run synchronously
            CreateReviewInput input,
            [Service] IReviewRepository repository //,
            //[Service]IEventSender eventSender
            )
        {
            var review = new Review(input.Stars, input.Commentary);

            repository.AddReview(input.Episode, review);
            //NOTE: REMOVED as Subscriptions have unknown support in Serverless Architecture (AzureFunctions).
            //await eventSender.SendAsync(new OnReviewMessage(input.Episode, review));
            return(new CreateReviewPayload(input.Episode, review));
        }