* Added method to Delete task
* Added WorkingDirectory to RunProcess method
This commit is contained in:
@@ -83,6 +83,21 @@ public class HangfireJobsController(JobStorage jobStorage, IRecurringJobManager
|
||||
return Ok("Zadanie zostało dodane.");
|
||||
}
|
||||
|
||||
[HttpPost("DeleteTask")]
|
||||
public async Task<IActionResult> DeleteTask([FromBody] TaskSchedulerDto taskSchedulerDto)
|
||||
{
|
||||
int result = await service.DeleteTaskScheduler(taskSchedulerDto.RowPointer);
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
return BadRequest("Nie udało się usunąć zadania.");
|
||||
}
|
||||
|
||||
recurringJobManager.RemoveIfExists(taskSchedulerDto.Name);
|
||||
|
||||
return Ok("Zadanie zostało usunięte.");
|
||||
}
|
||||
|
||||
[HttpGet("GetTasks")]
|
||||
public async Task<ActionResult<IEnumerable<TaskSchedulerDto>>> GetTasks()
|
||||
{
|
||||
@@ -117,7 +132,8 @@ public class HangfireJobsController(JobStorage jobStorage, IRecurringJobManager
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
CreateNoWindow = true
|
||||
CreateNoWindow = true,
|
||||
WorkingDirectory = Path.GetDirectoryName(pathToApp)
|
||||
}
|
||||
};
|
||||
process.Start();
|
||||
|
||||
Reference in New Issue
Block a user