private Message createCommand(Message message) { string type, title, text; text = message.Text; var match = System.Text.RegularExpressions.Regex.Match(text, Constants.regex_create); type = match.Groups[1].Value; title = match.Groups[2].Value; string reply = $"Creating new {type} with title {title}"; var dialogCreate = new TFSItem() { title = title, type = type }; Task.Factory.StartNew(() => { createTFSItem(message, dialogCreate); }); return(message.CreateReplyMessage(reply, "en")); }
public async Task <HttpResponseMessage> CreateVSTF(TFSItem item) { using (var client = new HttpClient()) { var response = await client.PostAsJsonAsync <TFSItem>(Constants.LogicAppCreateUrl, item); return(response); } }
private async void createTFSItem(Message message, TFSItem dialogCreate) { var response = await new LogicAppController().CreateVSTF(dialogCreate); string itemId = (string)JObject.Parse(await response.Content.ReadAsStringAsync())["id"]; await client.Messages.SendMessageAsync(message.CreateReplyMessage($"Created item {itemId}", "en")); }