-
Notifications
You must be signed in to change notification settings - Fork 29
/
ReceiverController.cs
35 lines (31 loc) · 1.11 KB
/
ReceiverController.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
35
using Microsoft.AspNetCore.Mvc;
using QBO.Shared;
using QBO.WebApp.Models;
namespace QBO.WebApp.Controllers
{
public class ReceiverController : Controller
{
public IActionResult Index()
{
// Get the current query string
// from current page.
string query = Request.QueryString.Value ?? "";
// Use the the shared helper library
// to validate the query parameters
// and write the output file.
if (QboHelper.CheckQueryParamsAndSet(query) && QboLocal.Tokens != null) {
QboHelper.WriteTokensAsJson(QboLocal.Tokens, ".\\NewTokens.json");
// Direct the view to the
// ReceiverViewModel to report
// a success message.
return View(new ReceiverViewModel("Success!"));
}
else {
// Otherwise direct the view to the
// ReceiverViewModel to report a
// failure message.
return View(new ReceiverViewModel("Authentication failed."));
}
}
}
}