public async Task SendTwitterMessageAsync(CfpInformation cfpInfo, string urlToCfp) { Guard.IsNotNull(cfpInfo, nameof(cfpInfo)); Guard.IsNotNull(urlToCfp, nameof(urlToCfp)); var sendTweetMessage = new SendTweetMessage { CfpEndDate = cfpInfo.CfpEndDate, EventStartDate = cfpInfo.EventStartDate, EventEndDate = cfpInfo.EventEndDate, EventLocationLatitude = cfpInfo.EventLocationLatitude, EventLocationLongitude = cfpInfo.EventLocationLongitude, EventName = cfpInfo.EventName, TwitterHandle = cfpInfo.TwitterHandle, UrlToCfp = urlToCfp }; var messageBody = JsonConvert.SerializeObject(sendTweetMessage); var message = new Message(Encoding.UTF8.GetBytes(messageBody)); await _twitterQueueClient.SendAsync(message); }
private async Task SendPostNewCfpMessageAsync(Cfp cfpToAdd) { try { var cfpInfo = new CfpInformation { CfpEndDate = cfpToAdd.CfpEndDate, EventStartDate = cfpToAdd.EventStartDate, EventEndDate = cfpToAdd.EventEndDate, EventLocationLatitude = (decimal)cfpToAdd.EventLocationLat, EventLocationLongitude = (decimal)cfpToAdd.EventLocationLng, EventName = cfpToAdd.EventName, TwitterHandle = cfpToAdd.EventTwitterHandle }; await _messageSender.SendTwitterMessageAsync(cfpInfo, Url.Action("details", "cfp", new { id = cfpToAdd.Id }, "https", "cfp.exchange")); } catch (Exception ex) { _logger.LogError(ex.Message); } }