qol: simplify accessors
This commit is contained in:
@@ -56,7 +56,7 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
else
|
||||
{
|
||||
// List Index
|
||||
var m = new Models.DeviceFlag.IndexModel()
|
||||
var m = new IndexModel()
|
||||
{
|
||||
DeviceFlags = Database.DeviceFlags
|
||||
.Select(uf => new
|
||||
|
||||
@@ -73,14 +73,14 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
m.CertificateAuthorityProviders = Plugins.GetPluginFeatures(typeof(CertificateAuthorityProviderFeature));
|
||||
m.WirelessProfileProviders = Plugins.GetPluginFeatures(typeof(WirelessProfileProviderFeature));
|
||||
|
||||
var DistributionValues = Enum.GetValues(typeof(Disco.Models.Repository.DeviceProfile.DistributionTypes));
|
||||
var DistributionValues = Enum.GetValues(typeof(DeviceProfile.DistributionTypes));
|
||||
m.DeviceProfileDistributionTypes = new List<SelectListItem>();
|
||||
foreach (int value in DistributionValues)
|
||||
{
|
||||
m.DeviceProfileDistributionTypes.Add(new SelectListItem()
|
||||
{
|
||||
Value = value.ToString(),
|
||||
Text = Enum.GetName(typeof(Disco.Models.Repository.DeviceProfile.DistributionTypes), value),
|
||||
Text = Enum.GetName(typeof(DeviceProfile.DistributionTypes), value),
|
||||
Selected = ((int)m.DeviceProfile.DistributionType == value)
|
||||
});
|
||||
}
|
||||
@@ -163,7 +163,7 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
DefaultAddDeviceOffline = Database.DiscoConfiguration.DeviceProfiles.DefaultAddDeviceOfflineDeviceProfileId
|
||||
};
|
||||
m.DeviceProfilesAndNone = m.DeviceProfiles.ToList();
|
||||
m.DeviceProfilesAndNone.Insert(0, new Disco.Models.Repository.DeviceProfile() { Id = 0, Name = "<No Default>" });
|
||||
m.DeviceProfilesAndNone.Insert(0, new DeviceProfile() { Id = 0, Name = "<No Default>" });
|
||||
|
||||
// UI Extensions
|
||||
UIExtensions.ExecuteExtensions<ConfigDeviceProfileDefaultsModel>(this.ControllerContext, m);
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
// Default Queue
|
||||
var m = new Models.JobQueue.CreateModel()
|
||||
{
|
||||
JobQueue = new Disco.Models.Repository.JobQueue()
|
||||
JobQueue = new JobQueue()
|
||||
{
|
||||
Icon = JobQueueService.RandomUnusedIcon(),
|
||||
IconColour = JobQueueService.RandomUnusedThemeColour(),
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
[DiscoAuthorize(Claims.Config.Plugin.Show), HttpGet]
|
||||
public virtual ActionResult Index()
|
||||
{
|
||||
Models.Plugins.IndexViewModel vm = new Models.Plugins.IndexViewModel()
|
||||
IndexViewModel vm = new IndexViewModel()
|
||||
{
|
||||
PluginManifests = Plugins.GetPlugins(),
|
||||
PluginLibrary = PluginLibrary.LoadManifest(Database)
|
||||
@@ -80,7 +80,7 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
var model = new Models.Plugins.InstallModel()
|
||||
var model = new InstallModel()
|
||||
{
|
||||
Library = library
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
{
|
||||
// Show
|
||||
var m = Database.UserFlags.Where(f => f.Id == id.Value).Select(f =>
|
||||
new Models.UserFlag.ShowModel()
|
||||
new ShowModel()
|
||||
{
|
||||
UserFlag = f,
|
||||
CurrentAssignmentCount = f.UserFlagAssignments.Count(a => !a.RemovedDate.HasValue),
|
||||
@@ -57,7 +57,7 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
else
|
||||
{
|
||||
// List Index
|
||||
var m = new Models.UserFlag.IndexModel()
|
||||
var m = new IndexModel()
|
||||
{
|
||||
UserFlags = Database.UserFlags
|
||||
.Select(uf => new
|
||||
@@ -81,7 +81,7 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
public virtual ActionResult Create()
|
||||
{
|
||||
// Default Queue
|
||||
var m = new Models.UserFlag.CreateModel()
|
||||
var m = new CreateModel()
|
||||
{
|
||||
UserFlag = new UserFlag()
|
||||
{
|
||||
@@ -97,7 +97,7 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
}
|
||||
|
||||
[DiscoAuthorizeAll(Claims.Config.UserFlag.Create, Claims.Config.UserFlag.Configure), HttpPost]
|
||||
public virtual ActionResult Create(Models.UserFlag.CreateModel model)
|
||||
public virtual ActionResult Create(CreateModel model)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user