Esempio n. 1
0
        public async Task Post(
            [FromBody] PostTriggerRequest request,
            [FromServices] ITriggerConverterService triggerConverterService,
            [FromServices] ITriggerProcessor triggerProcessor)
        {
            var userId = this.GetTelegramUserId();

            await Task.Run(() =>
            {
                var trigger = triggerConverterService.Parse(request);

                triggerProcessor.Save(trigger, userId);
            });
        }
Esempio n. 2
0
        public CryptoTrigger Parse(PostTriggerRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            switch (request.Type)
            {
            case "price":
                return(JsonConvert.DeserializeObject <PriceCryptoTrigger>(request.Trigger.ToString()));
            }

            return(null);
        }