protected string SerializeReservation(SetAlarmTime order) { return(JsonSerializer.Serialize(order, new JsonSerializerOptions { IgnoreNullValues = true })); }
private SetAlarmTime SetValidedAlarm(IDictionary <string, string> slots) { SetAlarmTime setTime = new SetAlarmTime { TimeType = _chosenTimeType, AlarmTime = slots.ContainsKey(ALARMTIME_SLOT) ? slots[ALARMTIME_SLOT] : null, }; return(setTime); }
public override LexResponse Process(LexEvent lexEvent, ILambdaContext context) { IDictionary <string, string> slots = lexEvent.CurrentIntent.Slots; IDictionary <string, string> sessionAttributes = lexEvent.SessionAttributes ?? new Dictionary <string, string>(); //if slots are empty returns the delegate if (slots.All(x => x.Value == null)) { } if (slots[TYPE_SLOT] != null) { var validateTimeType = ValidateTimeOfTheDay(slots[TYPE_SLOT]); if (!validateTimeType.IsValid) { slots[validateTimeType.ViolationSlot] = null; //return ElicitSlot(sessionAttributes, lexEvent.CurrentIntent.Name, slots, validateFlowerType.ViolationSlot, validateFlowerType.Message); } } SetAlarmTime setAlarmTime = SetValidedAlarm(slots); if (string.Equals(lexEvent.InvocationSource, "DialogCodeHook", StringComparison.Ordinal)) { //var validateResult = Validate(order); } return(Close( sessionAttributes, "Fulfilled", new LexResponse.LexMessage { ContentType = MESSAGE_CONTENT_TYPE, Content = String.Format("Alarm is set for {0} {1}.", setAlarmTime.AlarmTime, setAlarmTime.TimeType.ToString()) } )); }