コード例 #1
0
        public SkillResponse Handle(Intent intent)
        {
            var binDate       = intent.Slots["binDate"].Value;
            var localBindDate = NodaTime.AmazonDate.AmazonDateParser.Parse(binDate);
            var dateFrom      = localBindDate.From.ToDateTimeUnspecified();
            var dateTo        = localBindDate.To.ToDateTimeUnspecified();

            var nextBeans = TrashCalendar.TrashMonthInfos
                            .Where(x => x.Date >= dateFrom && x.Date <= dateTo).OrderBy(x => x.Date).ToList();

            var response = "";

            foreach (var trashMonthInfo in nextBeans)
            {
                response +=
                    $"Prepare {trashMonthInfo.TrashType} for {trashMonthInfo.Date.DayOfWeek} on {trashMonthInfo.Date.ToShortDateString()}.";
            }

            return(nextBeans.Any() ? AlexaResponseBuilder.MakeSkillResponse(response, false, response) :
                   AlexaResponseBuilder.MakeSkillResponse("During this period, they don't take any trash. ", true));
        }
コード例 #2
0
 public SkillResponse Handle(LaunchRequest inputRequest, ILambdaContext context)
 {
     return(AlexaResponseBuilder.MakeSkillResponse("Welcome on TrashCalendar. You can ask when you should be ready with your trash", false));
 }