Last active
December 29, 2017 11:17
-
-
Save r4hulp/f6cab1af630e3c94a4f0fa8248df4e85 to your computer and use it in GitHub Desktop.
Bot Framework Messages Controller with DI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// POST: api/Messages | |
/// Receive a message from a user and reply to it | |
/// </summary> | |
public async Task<HttpResponseMessage> Post([FromBody]Activity activity) | |
{ | |
if (activity.Type == ActivityTypes.Message) | |
{ | |
using (var scope = DialogModule.BeginLifetimeScope(Conversation.Container, activity)) | |
{ | |
var dialog = scope.Resolve<IDialog<object>>(); | |
await Conversation.SendAsync(activity, () => dialog); | |
} | |
} | |
. | |
. | |
//rest of the code removed for sanity.. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment