qol: simplify accessors
This commit is contained in:
@@ -15,7 +15,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
[HttpPost]
|
||||
public virtual ActionResult TestCallback(CallbackModel model)
|
||||
{
|
||||
return this.PrecompiledPartialView<API.Views.Activation._ActivateCallback>(model);
|
||||
return this.PrecompiledPartialView<Views.Activation._ActivateCallback>(model);
|
||||
}
|
||||
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
|
||||
#region Actions
|
||||
|
||||
public virtual ActionResult Delete(int id, Nullable<bool> redirect = false)
|
||||
public virtual ActionResult Delete(int id, bool? redirect = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -513,7 +513,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
#region Actions
|
||||
|
||||
[DiscoAuthorize(Claims.Config.DeviceBatch.Delete)]
|
||||
public virtual ActionResult Delete(int id, Nullable<bool> redirect = false)
|
||||
public virtual ActionResult Delete(int id, bool? redirect = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -247,7 +247,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
ComputerNameTemplate = ComputerNameTemplate,
|
||||
};
|
||||
|
||||
TestComputerNameTemplateModel.TestComputerNameTemplateResultModel evaluateDevice(Disco.Models.Repository.Device device)
|
||||
TestComputerNameTemplateModel.TestComputerNameTemplateResultModel evaluateDevice(Device device)
|
||||
{
|
||||
var evaluatorVariables = Expression.StandardVariables(null, Database, UserService.CurrentUser, DateTime.Now, null, device);
|
||||
var deviceResult = new TestComputerNameTemplateModel.TestComputerNameTemplateResultModel()
|
||||
|
||||
@@ -509,8 +509,8 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
public virtual ActionResult ImporterUndetectedFiles()
|
||||
{
|
||||
var undetectedLocation = DataStore.CreateLocation(Database, "DocumentDropBox_Unassigned");
|
||||
var undetectedDirectory = new System.IO.DirectoryInfo(undetectedLocation);
|
||||
var m = undetectedDirectory.GetFiles("*.pdf").Select(f => new Models.DocumentTemplate.ImporterUndetectedFilesModel()
|
||||
var undetectedDirectory = new DirectoryInfo(undetectedLocation);
|
||||
var m = undetectedDirectory.GetFiles("*.pdf").Select(f => new ImporterUndetectedFilesModel()
|
||||
{
|
||||
Id = System.IO.Path.GetFileNameWithoutExtension(f.Name),
|
||||
Timestamp = f.CreationTime.ToFullDateTime(),
|
||||
@@ -554,7 +554,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
}
|
||||
if (searchScope != null)
|
||||
{
|
||||
Models.DocumentTemplate.ImporterUndetectedDataIdLookupModel[] results;
|
||||
ImporterUndetectedDataIdLookupModel[] results;
|
||||
switch (searchScope)
|
||||
{
|
||||
case DocumentTemplate.DocumentTemplateScopes.Device:
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
private void UpdateScope(DocumentTemplatePackage Package, string Scope)
|
||||
{
|
||||
AttachmentTypes scope;
|
||||
if (!Enum.TryParse<AttachmentTypes>(Scope, true, out scope))
|
||||
if (!Enum.TryParse(Scope, true, out scope))
|
||||
throw new ArgumentException("Invalid Scope", nameof(Scope));
|
||||
|
||||
if (Package.Scope != scope)
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
const string pDefaultSLAExpiry = "defaultslaexpiry";
|
||||
|
||||
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
||||
public virtual ActionResult Update(int id, string key, string value = null, Nullable<bool> redirect = null)
|
||||
public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
|
||||
{
|
||||
Authorization.Require(Claims.Config.JobQueue.Configure);
|
||||
|
||||
@@ -77,37 +77,37 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
|
||||
#region Update Shortcut Methods
|
||||
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
||||
public virtual ActionResult UpdateName(int id, string QueueName = null, Nullable<bool> redirect = null)
|
||||
public virtual ActionResult UpdateName(int id, string QueueName = null, bool? redirect = null)
|
||||
{
|
||||
return Update(id, pName, QueueName, redirect);
|
||||
}
|
||||
|
||||
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
||||
public virtual ActionResult UpdateDescription(int id, string Description = null, Nullable<bool> redirect = null)
|
||||
public virtual ActionResult UpdateDescription(int id, string Description = null, bool? redirect = null)
|
||||
{
|
||||
return Update(id, pDescription, Description, redirect);
|
||||
}
|
||||
|
||||
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
||||
public virtual ActionResult UpdatePriority(int id, string Priority = null, Nullable<bool> redirect = null)
|
||||
public virtual ActionResult UpdatePriority(int id, string Priority = null, bool? redirect = null)
|
||||
{
|
||||
return Update(id, pPriority, Priority, redirect);
|
||||
}
|
||||
|
||||
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
||||
public virtual ActionResult UpdateDefaultSLAExpiry(int id, string DefaultSLAExpiry = null, Nullable<bool> redirect = null)
|
||||
public virtual ActionResult UpdateDefaultSLAExpiry(int id, string DefaultSLAExpiry = null, bool? redirect = null)
|
||||
{
|
||||
return Update(id, pDefaultSLAExpiry, DefaultSLAExpiry, redirect);
|
||||
}
|
||||
|
||||
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
||||
public virtual ActionResult UpdateIcon(int id, string Icon = null, Nullable<bool> redirect = null)
|
||||
public virtual ActionResult UpdateIcon(int id, string Icon = null, bool? redirect = null)
|
||||
{
|
||||
return Update(id, pIcon, Icon, redirect);
|
||||
}
|
||||
|
||||
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
||||
public virtual ActionResult UpdateIconColour(int id, string IconColour = null, Nullable<bool> redirect = null)
|
||||
public virtual ActionResult UpdateIconColour(int id, string IconColour = null, bool? redirect = null)
|
||||
{
|
||||
return Update(id, pIconColour, IconColour, redirect);
|
||||
}
|
||||
@@ -249,7 +249,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
{
|
||||
JobQueuePriority priority;
|
||||
|
||||
if (!Enum.TryParse<JobQueuePriority>(Priority, out priority))
|
||||
if (!Enum.TryParse(Priority, out priority))
|
||||
throw new ArgumentException("Invalid Priority Value", "Priority");
|
||||
|
||||
jobQueue.Priority = priority;
|
||||
@@ -312,7 +312,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateJobSubTypes(Disco.Models.Repository.JobQueue jobQueue, List<string> JobSubTypes)
|
||||
private void UpdateJobSubTypes(JobQueue jobQueue, List<string> JobSubTypes)
|
||||
{
|
||||
Database.Configuration.LazyLoadingEnabled = true;
|
||||
|
||||
@@ -326,7 +326,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
// Add New
|
||||
if (JobSubTypes != null && JobSubTypes.Count > 0)
|
||||
{
|
||||
var subTypes = new List<Disco.Models.Repository.JobSubType>();
|
||||
var subTypes = new List<JobSubType>();
|
||||
foreach (var stId in JobSubTypes)
|
||||
{
|
||||
var typeId = stId.Substring(0, stId.IndexOf("_"));
|
||||
@@ -342,7 +342,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
|
||||
#region Actions
|
||||
[DiscoAuthorize(Claims.Config.JobQueue.Delete)]
|
||||
public virtual ActionResult Delete(int id, Nullable<bool> redirect = false)
|
||||
public virtual ActionResult Delete(int id, bool? redirect = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
const string pSla = "sla";
|
||||
const string pPriority = "priority";
|
||||
|
||||
public virtual ActionResult Update(int id, string key, string value = null, Nullable<bool> redirect = null)
|
||||
public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -65,28 +65,28 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
|
||||
#region Update Shortcut Methods
|
||||
[DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnyComments, Claims.Job.Properties.JobQueueProperties.EditOwnComments)]
|
||||
public virtual ActionResult UpdateAddedComment(int id, string AddedComment = null, Nullable<bool> redirect = null)
|
||||
public virtual ActionResult UpdateAddedComment(int id, string AddedComment = null, bool? redirect = null)
|
||||
{
|
||||
return Update(id, pAddedComment, AddedComment, redirect);
|
||||
}
|
||||
[DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnyComments, Claims.Job.Properties.JobQueueProperties.EditOwnComments)]
|
||||
public virtual ActionResult UpdateRemovedComment(int id, string RemovedComment = null, Nullable<bool> redirect = null)
|
||||
public virtual ActionResult UpdateRemovedComment(int id, string RemovedComment = null, bool? redirect = null)
|
||||
{
|
||||
return Update(id, pRemovedComment, RemovedComment, redirect);
|
||||
}
|
||||
[DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnySLA, Claims.Job.Properties.JobQueueProperties.EditOwnSLA)]
|
||||
public virtual ActionResult UpdateSla(int id, string SLA = null, Nullable<bool> redirect = null)
|
||||
public virtual ActionResult UpdateSla(int id, string SLA = null, bool? redirect = null)
|
||||
{
|
||||
return Update(id, pSla, SLA, redirect);
|
||||
}
|
||||
[DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnyPriority, Claims.Job.Properties.JobQueueProperties.EditOwnPriority)]
|
||||
public virtual ActionResult UpdatePriority(int id, string Priority = null, Nullable<bool> redirect = null)
|
||||
public virtual ActionResult UpdatePriority(int id, string Priority = null, bool? redirect = null)
|
||||
{
|
||||
return Update(id, pPriority, Priority, redirect);
|
||||
}
|
||||
[DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnySLA, Claims.Job.Properties.JobQueueProperties.EditOwnSLA,
|
||||
Claims.Job.Properties.JobQueueProperties.EditAnyPriority, Claims.Job.Properties.JobQueueProperties.EditOwnPriority)]
|
||||
public virtual ActionResult UpdateSlaAndPriority(int id, string Sla = null, string Priority = null, Nullable<bool> redirect = null)
|
||||
public virtual ActionResult UpdateSlaAndPriority(int id, string Sla = null, string Priority = null, bool? redirect = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -166,7 +166,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
|
||||
JobQueuePriority priority;
|
||||
|
||||
if (!Enum.TryParse<JobQueuePriority>(Priority, out priority))
|
||||
if (!Enum.TryParse(Priority, out priority))
|
||||
throw new ArgumentException("Invalid Priority Value", "Priority");
|
||||
|
||||
jobQueueJob.OnEditPriority(priority);
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
const string pOnUnassignmentExpression = "onunassignmentexpression";
|
||||
|
||||
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
|
||||
public virtual ActionResult Update(int id, string key, string value = null, Nullable<bool> redirect = null)
|
||||
public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
|
||||
{
|
||||
Authorization.Require(Claims.Config.UserFlag.Configure);
|
||||
|
||||
@@ -81,25 +81,25 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
|
||||
#region Update Shortcut Methods
|
||||
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
|
||||
public virtual ActionResult UpdateName(int id, string FlagName = null, Nullable<bool> redirect = null)
|
||||
public virtual ActionResult UpdateName(int id, string FlagName = null, bool? redirect = null)
|
||||
{
|
||||
return Update(id, pName, FlagName, redirect);
|
||||
}
|
||||
|
||||
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
|
||||
public virtual ActionResult UpdateDescription(int id, string Description = null, Nullable<bool> redirect = null)
|
||||
public virtual ActionResult UpdateDescription(int id, string Description = null, bool? redirect = null)
|
||||
{
|
||||
return Update(id, pDescription, Description, redirect);
|
||||
}
|
||||
|
||||
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
|
||||
public virtual ActionResult UpdateIcon(int id, string Icon = null, Nullable<bool> redirect = null)
|
||||
public virtual ActionResult UpdateIcon(int id, string Icon = null, bool? redirect = null)
|
||||
{
|
||||
return Update(id, pIcon, Icon, redirect);
|
||||
}
|
||||
|
||||
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
|
||||
public virtual ActionResult UpdateIconColour(int id, string IconColour = null, Nullable<bool> redirect = null)
|
||||
public virtual ActionResult UpdateIconColour(int id, string IconColour = null, bool? redirect = null)
|
||||
{
|
||||
return Update(id, pIconColour, IconColour, redirect);
|
||||
}
|
||||
@@ -349,7 +349,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
|
||||
#region Actions
|
||||
[DiscoAuthorizeAll(Claims.Config.UserFlag.Configure, Claims.Config.UserFlag.Delete)]
|
||||
public virtual ActionResult Delete(int id, Nullable<bool> redirect = false)
|
||||
public virtual ActionResult Delete(int id, bool? redirect = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user