Commit 0688abb8 authored by David McCullough's avatar David McCullough

Added a members only area

parent bc252395
......@@ -5,6 +5,7 @@ using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using DemystifyTutorial.Part1.Models;
using Microsoft.AspNetCore.Authorization;
namespace DemystifyTutorial.Part1.Controllers {
public class HomeController : Controller {
......@@ -16,6 +17,11 @@ namespace DemystifyTutorial.Part1.Controllers {
return View();
}
[Authorize]
public IActionResult Members() {
return View();
}
public IActionResult Error() {
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
......
@{
ViewBag.Title = "Members Only";
}
<h2>@ViewBag.Title</h2>
<p>You must be a member. Congratulations, @User.Identity.Name, on your membership!</p>
......@@ -32,6 +32,7 @@
<ul class="nav navbar-nav">
<li><a asp-area="" asp-controller="Home" asp-action="Index">Home</a></li>
<li><a asp-area="" asp-controller="Home" asp-action="About">About</a></li>
<li><a asp-area="" asp-controller="Home" asp-action="Members">Members</a></li>
</ul>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment