Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

FindHotelsAction_ChangeLocation.cs 1.1 KB

You have to be logged in to leave a comment. Sign In
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
  1. namespace LuisActions.Samples
  2. {
  3. using System;
  4. using System.ComponentModel.DataAnnotations;
  5. using System.Threading.Tasks;
  6. using Microsoft.Cognitive.LUIS.ActionBinding;
  7. [Serializable]
  8. [LuisActionBinding("FindHotels-ChangeLocation", FriendlyName = "Change the hotel location")]
  9. public class FindHotelsAction_ChangeLocation : BaseLuisContextualAction<FindHotelsAction>
  10. {
  11. [Required(ErrorMessage = "Please provide a new location for your hotel")]
  12. [Location(ErrorMessage = "Please provide a new valid location for your hotel")]
  13. [LuisActionBindingParam(BuiltinType = BuiltInGeographyTypes.City)]
  14. public string Place { get; set; }
  15. public override Task<object> FulfillAsync()
  16. {
  17. if (this.Context == null)
  18. {
  19. throw new InvalidOperationException("Action context not defined.");
  20. }
  21. // assign new location to FindHotelsAction
  22. this.Context.Place = this.Place;
  23. return Task.FromResult((object)$"Hotel location changed to {this.Place}");
  24. }
  25. }
  26. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...