Ejemplo n.º 1
0
        public async Task <IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req, ILogger log)
        {
            try
            {
                SubscriptionSettings settings = await this.GetSettings(req);

                IComicRetriever retriever = ComicRetrieverFactory.Get(settings.SubscriptionName);
                ComicStrip      comic     = await retriever.GetComic();

                ComicSendingController sendingController = new ComicSendingController(comic);
                ComicDeliveryResult    result            = await sendingController.Push(settings);

                if (result.IsSuccess)
                {
                    await subscriberRegister.AddSubscriber(settings);

                    return(new OkObjectResult("Subscribed"));
                }
                else
                {
                    return(new BadRequestErrorMessageResult("Error while sending test comic: " + result.Message));
                }
            }
            catch (Exception ex)
            {
                return(new BadRequestErrorMessageResult(ex.Message));
            }
        }
Ejemplo n.º 2
0
 public CommitStripRandom(ISubscriberProvider subscriberProvider)
 {
     this.retriever          = ComicRetrieverFactory.Get(subscriptionName);
     this.subscriberProvider = subscriberProvider;
 }