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); }); }
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); }