forked from microsoft/BotBuilder-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FindHotelsAction_ChangeLocation.cs
30 lines (26 loc) · 1.08 KB
/
FindHotelsAction_ChangeLocation.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
namespace LuisActions.Samples
{
using System;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.Cognitive.LUIS.ActionBinding;
[Serializable]
[LuisActionBinding("FindHotels-ChangeLocation", FriendlyName = "Change the hotel location")]
public class FindHotelsAction_ChangeLocation : BaseLuisContextualAction<FindHotelsAction>
{
[Required(ErrorMessage = "Please provide a new location for your hotel")]
[Location(ErrorMessage = "Please provide a new valid location for your hotel")]
[LuisActionBindingParam(BuiltinType = BuiltInGeographyTypes.City)]
public string Place { get; set; }
public override Task<object> FulfillAsync()
{
if (this.Context == null)
{
throw new InvalidOperationException("Action context not defined.");
}
// assign new location to FindHotelsAction
this.Context.Place = this.Place;
return Task.FromResult((object)$"Hotel location changed to {this.Place}");
}
}
}