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_ChangeCheckout.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
  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-ChangeCheckout", FriendlyName = "Change the hotel checkout date", CanExecuteWithNoContext = false)]
  9. public class FindHotelsAction_ChangeCheckout : BaseLuisContextualAction<FindHotelsAction>
  10. {
  11. [Required(ErrorMessage = "Please provide the new check-out date")]
  12. [LuisActionBindingParam(BuiltinType = BuiltInDatetimeTypes.Date)]
  13. public DateTime? Checkout { get; set; }
  14. public override Task<object> FulfillAsync()
  15. {
  16. if (this.Context == null)
  17. {
  18. throw new InvalidOperationException("Action context not defined.");
  19. }
  20. // assign new check-out date to FindHotelsAction
  21. this.Context.Checkout = this.Checkout;
  22. return Task.FromResult((object)$"Hotel checkin date changed to {this.Checkout?.ToShortDateString()}");
  23. }
  24. }
  25. }
Tip!

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

Comments

Loading...