예제 #1
0
        public async Task <IActionResult> Delete(string id)
        {
            Guid jobId       = new Guid(id);
            var  existingJob = repository.GetOne(jobId);

            if (existingJob == null)
            {
                ModelState.AddModelError("Job", "Job cannot be found or does not exist.");
                return(NotFound(ModelState));
            }

            var response = await base.DeleteEntity(id);

            jobManager.DeleteExistingParameters(jobId);
            jobManager.DeleteExistingCheckpoints(jobId);

            //send SignalR notification to all connected clients
            await _hub.Clients.All.SendAsync("sendjobnotification", string.Format("Job id {0} deleted.", id));

            await webhookPublisher.PublishAsync("Jobs.JobDeleted", existingJob.Id.ToString()).ConfigureAwait(false);

            return(response);
        }