forked from microsoft/BotBuilder-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindHotelsAction.cs
34 lines (28 loc) · 1.4 KB
/
FindHotelsAction.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
31
32
33
34
namespace LuisActions.Samples
{
using System;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.Cognitive.LUIS.ActionBinding;
[Serializable]
[LuisActionBinding("FindHotels", FriendlyName = "Find Hotel Room")]
public class FindHotelsAction : BaseLuisAction
{
public string Category { get; set; }
[Required(ErrorMessage = "Please provide the check-in date")]
[LuisActionBindingParam(BuiltinType = BuiltInDatetimeTypes.Date, Order = 2)]
public DateTime? Checkin { get; set; }
[Required(ErrorMessage = "Please provide the check-out date")]
[LuisActionBindingParam(BuiltinType = BuiltInDatetimeTypes.Date, Order = 3)]
public DateTime? Checkout { get; set; }
[Required(ErrorMessage = "Please provide a location")]
[Location(ErrorMessage = "Please provide a valid location")]
[LuisActionBindingParam(BuiltinType = BuiltInGeographyTypes.City, Order = 1)]
public string Place { get; set; }
public string RoomType { get; set; }
public override Task<object> FulfillAsync()
{
return Task.FromResult((object)$"Sorry, there are no {this.RoomType} rooms available at {this.Place} for your chosen dates ({this.Checkin.Value.ToShortDateString()} to {this.Checkout.Value.ToShortDateString()}), please try another search.");
}
}
}