Fix naming conventions for private fields

This commit is contained in:
Hisham Bin Ateya
2020-03-05 01:46:53 +03:00
parent e74f0d7644
commit a46235ea1e
75 changed files with 1219 additions and 1219 deletions

View File

@ -14,15 +14,15 @@ namespace Oqtane.Controllers
[Route("{site}/api/[controller]")]
public class JobController : Controller
{
private readonly IJobRepository Jobs;
private readonly ILogManager logger;
private readonly IServiceProvider ServiceProvider;
private readonly IJobRepository _jobs;
private readonly ILogManager _logger;
private readonly IServiceProvider _serviceProvider;
public JobController(IJobRepository Jobs, ILogManager logger, IServiceProvider ServiceProvider)
{
this.Jobs = Jobs;
this.logger = logger;
this.ServiceProvider = ServiceProvider;
this._jobs = Jobs;
this._logger = logger;
this._serviceProvider = ServiceProvider;
}
// GET: api/<controller>
@ -30,7 +30,7 @@ namespace Oqtane.Controllers
[Authorize(Roles = Constants.HostRole)]
public IEnumerable<Job> Get()
{
return Jobs.GetJobs();
return _jobs.GetJobs();
}
// GET api/<controller>/5
@ -38,7 +38,7 @@ namespace Oqtane.Controllers
[Authorize(Roles = Constants.HostRole)]
public Job Get(int id)
{
return Jobs.GetJob(id);
return _jobs.GetJob(id);
}
// POST api/<controller>
@ -48,8 +48,8 @@ namespace Oqtane.Controllers
{
if (ModelState.IsValid)
{
Job = Jobs.AddJob(Job);
logger.Log(LogLevel.Information, this, LogFunction.Create, "Job Added {Job}", Job);
Job = _jobs.AddJob(Job);
_logger.Log(LogLevel.Information, this, LogFunction.Create, "Job Added {Job}", Job);
}
return Job;
}
@ -61,8 +61,8 @@ namespace Oqtane.Controllers
{
if (ModelState.IsValid)
{
Job = Jobs.UpdateJob(Job);
logger.Log(LogLevel.Information, this, LogFunction.Update, "Job Updated {Job}", Job);
Job = _jobs.UpdateJob(Job);
_logger.Log(LogLevel.Information, this, LogFunction.Update, "Job Updated {Job}", Job);
}
return Job;
}
@ -72,8 +72,8 @@ namespace Oqtane.Controllers
[Authorize(Roles = Constants.HostRole)]
public void Delete(int id)
{
Jobs.DeleteJob(id);
logger.Log(LogLevel.Information, this, LogFunction.Delete, "Job Deleted {JobId}", id);
_jobs.DeleteJob(id);
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Job Deleted {JobId}", id);
}
// GET api/<controller>/start
@ -81,11 +81,11 @@ namespace Oqtane.Controllers
[Authorize(Roles = Constants.HostRole)]
public void Start(int id)
{
Job job = Jobs.GetJob(id);
Job job = _jobs.GetJob(id);
Type jobtype = Type.GetType(job.JobType);
if (jobtype != null)
{
var jobobject = ActivatorUtilities.CreateInstance(ServiceProvider, jobtype);
var jobobject = ActivatorUtilities.CreateInstance(_serviceProvider, jobtype);
((IHostedService)jobobject).StartAsync(new System.Threading.CancellationToken());
}
}
@ -95,11 +95,11 @@ namespace Oqtane.Controllers
[Authorize(Roles = Constants.HostRole)]
public void Stop(int id)
{
Job job = Jobs.GetJob(id);
Job job = _jobs.GetJob(id);
Type jobtype = Type.GetType(job.JobType);
if (jobtype != null)
{
var jobobject = ActivatorUtilities.CreateInstance(ServiceProvider, jobtype);
var jobobject = ActivatorUtilities.CreateInstance(_serviceProvider, jobtype);
((IHostedService)jobobject).StopAsync(new System.Threading.CancellationToken());
}
}