public override async Task <SpeechletResponse> OnIntentAsync(IntentRequest intentRequest, Session session)
        {
            if (AlexaUtils.IsRequestInvalid(session))
            {
                return(await Task.FromResult <SpeechletResponse>(InvalidApplicationId(session)));
            }

            var intent     = intentRequest.Intent;
            var intentName = intent?.Name;

            switch (intentName.ToUpper())
            {
            case "BALANCE":
                return(await GetBalance.GetResults(session));

            case "TRANSACTIONS":
                return(await GetTransactions.GetResults(session, intentRequest.Intent.Slots["date"].Value));

            case "PAYMENT":
                return(await MakePayment.GetResults(session, decimal.Parse(intentRequest.Intent.Slots["amount"].Value), intentRequest.Intent.Slots["account"].Value));

            case "WINNERS":
                return(await Winners.GetResults());

            case "MORTGAGE":
                return(await Mortgage.GetResults(session));

            case "SAVINGS":
                return(await Insights.GetResults(session));

            default:
                return(await Task.FromResult <SpeechletResponse>(GetOnLaunchAsyncResult(session)));
            }
        }
Exemple #2
0
 public async Task <List <Transaction> > Handle(GetTransactions request, CancellationToken cancellationToken)
 {
     return(await _db.Transactions
            .Select(t => new Transaction
     {
         Account = t.Account,
         Date = t.Date,
         Description = t.Description,
         Amount = t.Amount,
     })
            .ToListAsync(cancellationToken));
 }
 public TransactionController(ExecuteTransaction executeTransaction, GetTransactions getTransactios)
 {
     _executeTransaction = executeTransaction;
     _getTransactions    = getTransactios;
 }