diff options
| author | Michael <[email protected]> | 2017-03-23 09:47:22 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-03-23 09:47:28 -0400 |
| commit | 8f1fbeadb243a486dce7bbfd9b932a551fd36350 (patch) | |
| tree | 927829d15e2091dc09d699cba3be7659a800d494 /Project-Unite | |
| parent | b0b5c4163c4317283cbcd4647318907ec823f62f (diff) | |
| download | project-unite-8f1fbeadb243a486dce7bbfd9b932a551fd36350.tar.gz project-unite-8f1fbeadb243a486dce7bbfd9b932a551fd36350.tar.bz2 project-unite-8f1fbeadb243a486dce7bbfd9b932a551fd36350.zip | |
Display newest user in right navbar
Diffstat (limited to 'Project-Unite')
| -rw-r--r-- | Project-Unite/ACL.cs | 10 | ||||
| -rw-r--r-- | Project-Unite/Controllers/HomeController.cs | 1 | ||||
| -rw-r--r-- | Project-Unite/Models/HomeViewModel.cs | 12 | ||||
| -rw-r--r-- | Project-Unite/Project-Unite.csproj | 1 | ||||
| -rw-r--r-- | Project-Unite/Views/Shared/_Layout.cshtml | 8 |
5 files changed, 31 insertions, 1 deletions
diff --git a/Project-Unite/ACL.cs b/Project-Unite/ACL.cs index c0a0894..4b4e6b0 100644 --- a/Project-Unite/ACL.cs +++ b/Project-Unite/ACL.cs @@ -13,6 +13,16 @@ namespace Project_Unite { public static class ACL { + public static IHtmlString NewestUser(this HtmlHelper hpr) + { + var db = new ApplicationDbContext(); + var user = db.Users.OrderByDescending(x => x.JoinedAt).FirstOrDefault(); + if (user == null) + return hpr.Raw(@"<a href=""#"">No new users</a>"); + else + return hpr.Raw("<a href=\"/Profiles/ViewProfile/" + user.DisplayName + "\">Our newest user, <strong>" + user.DisplayName + "</strong></a>"); + } + public static IHtmlString Markdown(this HtmlHelper hpr, string md) { return hpr.Raw(CommonMark.CommonMarkConverter.Convert(hpr.Encode(md))); diff --git a/Project-Unite/Controllers/HomeController.cs b/Project-Unite/Controllers/HomeController.cs index a3a8f7f..5a1553f 100644 --- a/Project-Unite/Controllers/HomeController.cs +++ b/Project-Unite/Controllers/HomeController.cs @@ -11,6 +11,7 @@ namespace Project_Unite.Controllers { public ActionResult Index() { + return View(); } diff --git a/Project-Unite/Models/HomeViewModel.cs b/Project-Unite/Models/HomeViewModel.cs new file mode 100644 index 0000000..d9d98bb --- /dev/null +++ b/Project-Unite/Models/HomeViewModel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace Project_Unite.Models +{ + public class HomeViewModel + { + public ApplicationUser NewestUser { get; set; } + } +}
\ No newline at end of file diff --git a/Project-Unite/Project-Unite.csproj b/Project-Unite/Project-Unite.csproj index 88d1527..100b767 100644 --- a/Project-Unite/Project-Unite.csproj +++ b/Project-Unite/Project-Unite.csproj @@ -405,6 +405,7 @@ <Compile Include="Models\AdminViewModels.cs" /> <Compile Include="Models\ForumCategory.cs" /> <Compile Include="Models\ForumViewModels.cs" /> + <Compile Include="Models\HomeViewModel.cs" /> <Compile Include="Models\IdentityModels.cs" /> <Compile Include="Models\ManageViewModels.cs" /> <Compile Include="Models\Role.cs" /> diff --git a/Project-Unite/Views/Shared/_Layout.cshtml b/Project-Unite/Views/Shared/_Layout.cshtml index 0e64010..932593f 100644 --- a/Project-Unite/Views/Shared/_Layout.cshtml +++ b/Project-Unite/Views/Shared/_Layout.cshtml @@ -3,7 +3,7 @@ <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>@ViewBag.Title - My ASP.NET Application</title> + <title>@ViewBag.Title • Project: Unite</title> @Styles.Render("~/Content/css") @Styles.Render("~/Content/bootstrap-theme.css") @Styles.Render("~/Content/Site.css") @@ -75,6 +75,12 @@ } <div class="container clearfix body-content"> + <div class="panel panel-success"> + <div class="panel-body"> + <p><span class="glyphicon glyphicon-exclamation-sign"></span> <strong>Welcome to Project: Unite!</strong> Things are a bit barren right now and not a lot of stuff is implemented - but feel free to explore!</p> + </div> + </div> + @if (!ACL.UserEmailConfirmed(User.Identity.Name)) { <div class="panel panel-warning"> |
