forked from microsoft/BotBuilder-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHotelsQuery.cs
34 lines (30 loc) · 863 Bytes
/
HotelsQuery.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 BotBuilder.Samples.AdaptiveCards
{
using System;
using System.ComponentModel.DataAnnotations;
public class HotelsQuery
{
[Required]
public string Destination { get; set; }
[Required]
public DateTime? Checkin { get; set; }
[Range(1, 60)]
public int? Nights { get; set; }
public static HotelsQuery Parse(dynamic o)
{
try
{
return new HotelsQuery
{
Destination = o.Destination.ToString(),
Checkin = DateTime.Parse(o.Checkin.ToString()),
Nights = int.Parse(o.Nights.ToString())
};
}
catch
{
throw new InvalidCastException("HotelQuery could not be read");
}
}
}
}