diff --git a/MileageTraker.sln.DotSettings b/MileageTraker.sln.DotSettings index 1ee022e..b69390c 100644 --- a/MileageTraker.sln.DotSettings +++ b/MileageTraker.sln.DotSettings @@ -1,2 +1,3 @@  - DO_NOT_SHOW \ No newline at end of file + DO_NOT_SHOW + True \ No newline at end of file diff --git a/Web/Controllers/UserController.cs b/Web/Controllers/UserController.cs index 79faad1..f103428 100644 --- a/Web/Controllers/UserController.cs +++ b/Web/Controllers/UserController.cs @@ -15,15 +15,18 @@ namespace MileageTraker.Web.Controllers [Authorize(Roles = "Administrator, Developer")] public class UserController : ControllerBase { - public ActionResult Index() + public ActionResult Index(bool disabled = false) { - var users = - DataService - .GetUsers() - .ToList() - .OrderBy(u => u.Username); + var users = + from u in DataService.GetUsers() + where u.IsApproved == !disabled + orderby u.Username + select u; - return View(users); + var userResultsViewModel = new UserResultsViewModel(users.ToList(), disabled); + + + return View(userResultsViewModel); } [ActionLog] diff --git a/Web/Controllers/VehicleController.cs b/Web/Controllers/VehicleController.cs index 1797043..ae400dd 100644 --- a/Web/Controllers/VehicleController.cs +++ b/Web/Controllers/VehicleController.cs @@ -6,7 +6,6 @@ using MileageTraker.Web.DAL; using MileageTraker.Web.Models; using MileageTraker.Web.Utility; using MileageTraker.Web.ViewModels.Vehicle; -using MileageTraker.Web.ViewModels.VehicleService; namespace MileageTraker.Web.Controllers { diff --git a/Web/Scripts/Shared/Site.js b/Web/Scripts/Shared/Site.js index 094384b..c162609 100644 --- a/Web/Scripts/Shared/Site.js +++ b/Web/Scripts/Shared/Site.js @@ -213,6 +213,7 @@ function addButtonIcons () { 'Vehicle Mileage': 'car', 'Show Active': 'check-circle', 'Show Inactive': 'ban', + 'Show Disabled Accts': 'ban', 'Set Inactive' : 'ban', 'Reactivate': 'check-circle', 'Config': 'cog', diff --git a/Web/ViewModels/User/UserResultsViewModel.cs b/Web/ViewModels/User/UserResultsViewModel.cs new file mode 100644 index 0000000..243367f --- /dev/null +++ b/Web/ViewModels/User/UserResultsViewModel.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace MileageTraker.Web.ViewModels.User +{ + public class UserResultsViewModel + { + public IEnumerable Users { get; set; } + public bool Disabled { get; } + + public UserResultsViewModel(IEnumerable users, bool disabled) + { + Users = users; + Disabled = disabled; + } + } +} \ No newline at end of file diff --git a/Web/Views/User/Index.cshtml b/Web/Views/User/Index.cshtml index b466b54..b1c73bd 100644 --- a/Web/Views/User/Index.cshtml +++ b/Web/Views/User/Index.cshtml @@ -1,9 +1,9 @@ @using MileageTraker.Web.Models -@model IEnumerable +@model MileageTraker.Web.ViewModels.User.UserResultsViewModel @{ ViewBag.Title = "Users"; - var grid = new WebGrid(Model, rowsPerPage: 45); + var grid = new WebGrid(Model.Users, rowsPerPage: 45); } @Html.Partial("_StatusMessage") @@ -20,6 +20,8 @@
@Html.ActionLink("Add new User", "Create", null, new{@class="btn"}) @Html.ActionLink("Export", "Export", null, new{@class="btn"}) + @Html.ActionLink(Model.Disabled ? "Show Active" : "Show Disabled Accts", "Index", new {disabled = !Model.Disabled}, new { @class = "btn" }) + @if (User.IsInRole("Developer")) { @Html.ActionLink("Invite Uninintialized", "InviteUninitialized", null, new{@class="btn"}) diff --git a/Web/Web.csproj b/Web/Web.csproj index c37c28f..2872e1e 100644 --- a/Web/Web.csproj +++ b/Web/Web.csproj @@ -166,6 +166,7 @@ +