Filter users by active/disabled
This commit is contained in:
@@ -1,2 +1,3 @@
|
|||||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ClassWithVirtualMembersNeverInherited_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String></wpf:ResourceDictionary>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ClassWithVirtualMembersNeverInherited_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Traker/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||||
@@ -15,15 +15,18 @@ namespace MileageTraker.Web.Controllers
|
|||||||
[Authorize(Roles = "Administrator, Developer")]
|
[Authorize(Roles = "Administrator, Developer")]
|
||||||
public class UserController : ControllerBase
|
public class UserController : ControllerBase
|
||||||
{
|
{
|
||||||
public ActionResult Index()
|
public ActionResult Index(bool disabled = false)
|
||||||
{
|
{
|
||||||
var users =
|
var users =
|
||||||
DataService
|
from u in DataService.GetUsers()
|
||||||
.GetUsers()
|
where u.IsApproved == !disabled
|
||||||
.ToList()
|
orderby u.Username
|
||||||
.OrderBy(u => u.Username);
|
select u;
|
||||||
|
|
||||||
return View(users);
|
var userResultsViewModel = new UserResultsViewModel(users.ToList(), disabled);
|
||||||
|
|
||||||
|
|
||||||
|
return View(userResultsViewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ActionLog]
|
[ActionLog]
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ using MileageTraker.Web.DAL;
|
|||||||
using MileageTraker.Web.Models;
|
using MileageTraker.Web.Models;
|
||||||
using MileageTraker.Web.Utility;
|
using MileageTraker.Web.Utility;
|
||||||
using MileageTraker.Web.ViewModels.Vehicle;
|
using MileageTraker.Web.ViewModels.Vehicle;
|
||||||
using MileageTraker.Web.ViewModels.VehicleService;
|
|
||||||
|
|
||||||
namespace MileageTraker.Web.Controllers
|
namespace MileageTraker.Web.Controllers
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ function addButtonIcons () {
|
|||||||
'Vehicle Mileage': 'car',
|
'Vehicle Mileage': 'car',
|
||||||
'Show Active': 'check-circle',
|
'Show Active': 'check-circle',
|
||||||
'Show Inactive': 'ban',
|
'Show Inactive': 'ban',
|
||||||
|
'Show Disabled Accts': 'ban',
|
||||||
'Set Inactive' : 'ban',
|
'Set Inactive' : 'ban',
|
||||||
'Reactivate': 'check-circle',
|
'Reactivate': 'check-circle',
|
||||||
'Config': 'cog',
|
'Config': 'cog',
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace MileageTraker.Web.ViewModels.User
|
||||||
|
{
|
||||||
|
public class UserResultsViewModel
|
||||||
|
{
|
||||||
|
public IEnumerable<Models.User> Users { get; set; }
|
||||||
|
public bool Disabled { get; }
|
||||||
|
|
||||||
|
public UserResultsViewModel(IEnumerable<Models.User> users, bool disabled)
|
||||||
|
{
|
||||||
|
Users = users;
|
||||||
|
Disabled = disabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
@using MileageTraker.Web.Models
|
@using MileageTraker.Web.Models
|
||||||
@model IEnumerable<User>
|
@model MileageTraker.Web.ViewModels.User.UserResultsViewModel
|
||||||
|
|
||||||
@{
|
@{
|
||||||
ViewBag.Title = "Users";
|
ViewBag.Title = "Users";
|
||||||
var grid = new WebGrid(Model, rowsPerPage: 45);
|
var grid = new WebGrid(Model.Users, rowsPerPage: 45);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Html.Partial("_StatusMessage")
|
@Html.Partial("_StatusMessage")
|
||||||
@@ -20,6 +20,8 @@
|
|||||||
<div class="btn-toolbar pull-left">
|
<div class="btn-toolbar pull-left">
|
||||||
@Html.ActionLink("Add new User", "Create", null, new{@class="btn"})
|
@Html.ActionLink("Add new User", "Create", null, new{@class="btn"})
|
||||||
@Html.ActionLink("Export", "Export", 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"))
|
@if (User.IsInRole("Developer"))
|
||||||
{
|
{
|
||||||
@Html.ActionLink("Invite Uninintialized", "InviteUninitialized", null, new{@class="btn"})
|
@Html.ActionLink("Invite Uninintialized", "InviteUninitialized", null, new{@class="btn"})
|
||||||
|
|||||||
@@ -166,6 +166,7 @@
|
|||||||
<Compile Include="Email\ServiceReminderEmailService.cs" />
|
<Compile Include="Email\ServiceReminderEmailService.cs" />
|
||||||
<Compile Include="Startup.cs" />
|
<Compile Include="Startup.cs" />
|
||||||
<Compile Include="ViewModels\DriverMileageFlattenedViewModel.cs" />
|
<Compile Include="ViewModels\DriverMileageFlattenedViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\User\UserResultsViewModel.cs" />
|
||||||
<Compile Include="ViewModels\VehicleService\VehicleSelectViewModel.cs" />
|
<Compile Include="ViewModels\VehicleService\VehicleSelectViewModel.cs" />
|
||||||
<Compile Include="ViewModels\VehicleService\UpdateServiceRemindersViewModel.cs" />
|
<Compile Include="ViewModels\VehicleService\UpdateServiceRemindersViewModel.cs" />
|
||||||
<Compile Include="Controllers\FuelLogController.cs" />
|
<Compile Include="Controllers\FuelLogController.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user