diff options
| author | Michael <[email protected]> | 2017-04-06 15:13:41 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-04-06 15:13:41 -0400 |
| commit | 1675a18905e395320da710485c4052a3f28606dc (patch) | |
| tree | 6fd9338c7c89982c0e75b4f9fe13e684625d4cc4 /Project-Unite/Controllers/WikiControllerController.cs | |
| parent | e28195596b54360767a50be97f7976d7f8004aa3 (diff) | |
| download | project-unite-1675a18905e395320da710485c4052a3f28606dc.tar.gz project-unite-1675a18905e395320da710485c4052a3f28606dc.tar.bz2 project-unite-1675a18905e395320da710485c4052a3f28606dc.zip | |
"Random page" link in wiki
Diffstat (limited to 'Project-Unite/Controllers/WikiControllerController.cs')
| -rw-r--r-- | Project-Unite/Controllers/WikiControllerController.cs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Project-Unite/Controllers/WikiControllerController.cs b/Project-Unite/Controllers/WikiControllerController.cs index f6b09cd..435e5bd 100644 --- a/Project-Unite/Controllers/WikiControllerController.cs +++ b/Project-Unite/Controllers/WikiControllerController.cs @@ -20,6 +20,18 @@ namespace Project_Unite.Controllers return View(model); } + public ActionResult Random() + { + var db = new ApplicationDbContext(); + var rnd = new Random(); + var index = rnd.Next(0, db.WikiPages.Count()); + if (db.WikiPages.Count() == 0) + return RedirectToAction("Index"); + + var wiki = db.WikiPages.ToArray()[index].Id; + return RedirectToAction("Index", new { id = wiki }); + } + [Authorize] public ActionResult AddPage() { |
