summaryrefslogtreecommitdiff
path: root/Project-Unite/Controllers/APIController.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-05-30 17:34:15 -0400
committerMichael <[email protected]>2017-05-30 17:34:15 -0400
commit0add14850adff48d3421d2527d8e40b18b606131 (patch)
tree68118a51daeb7d4ab281fcfd24588462c526266d /Project-Unite/Controllers/APIController.cs
parent78a5e3d4b22299b2ae3b95bada43e556b79c0bdf (diff)
downloadproject-unite-0add14850adff48d3421d2527d8e40b18b606131.tar.gz
project-unite-0add14850adff48d3421d2527d8e40b18b606131.tar.bz2
project-unite-0add14850adff48d3421d2527d8e40b18b606131.zip
Quotes backend, sorta.
Diffstat (limited to 'Project-Unite/Controllers/APIController.cs')
-rw-r--r--Project-Unite/Controllers/APIController.cs24
1 files changed, 23 insertions, 1 deletions
diff --git a/Project-Unite/Controllers/APIController.cs b/Project-Unite/Controllers/APIController.cs
index f225c68..925fb90 100644
--- a/Project-Unite/Controllers/APIController.cs
+++ b/Project-Unite/Controllers/APIController.cs
@@ -12,6 +12,28 @@ namespace Project_Unite.Controllers
{
public class APIController : Controller
{
+ public ActionResult GetRandomQuote()
+ {
+ var db = new ApplicationDbContext();
+ var quotes = db.Quotes.ToArray();
+ if (quotes.Length == 0)
+ {
+ return Content(Serializer.Serialize(new Quote
+ {
+ Id = "DEADDEAD",
+ AuthorAvatar = "",
+ AuthorId = "No data.",
+ Body = "There is no quote data on http://getshiftos.ml/. Please submit some quotes!",
+ Year = 8675309
+ }));
+ }
+ else
+ {
+ var rnd = new Random();
+ return Content(Serializer.Serialize(quotes[rnd.Next(0, quotes.Length)]));
+ }
+ }
+
public ActionResult GetPongCP()
{
try
@@ -103,7 +125,7 @@ namespace Project_Unite.Controllers
}
}
- public ActionResult SetCodepoints(long id)
+ public ActionResult SetCodepoints(ulong id)
{
try
{