public async Task AddNewTask(AddJobViewModel model) { if (model.Value == null) { model.Value = ""; } var newTask = new ReoccurringJob { Name = model.Name, Url = model.Url, CronString = model.CronString, PriorityField = model.PriorityField, ConditionalExpression = new string[] { model.Conditional.ToString(), model.Value.ToString() }, ContactGroup_Id = model.ContactGroupId, }; try { _dataContext.ReoccurringJob.Add(newTask); } catch (Exception e) { Console.WriteLine(e.Message); } await _dataContext.SaveChangesAsync(); _dataContext.CurrentJobResults.Add(new CurrentJobResult { Name = newTask.Name, ReoccurringJobId = newTask.Id, Status = "Unchecked", Date = DateTime.MinValue, }); await _dataContext.SaveChangesAsync(); }
public CurrentApiJob(DataContext dataContext, ReoccurringJob task) { _task = task; _dataContext = dataContext; Console.WriteLine(_dataContext); }
public async Task RunTask(ReoccurringJob task) { var job = _apiJobFactory.CurrentJob(task); await job.Run <TotalJobsApiResponse>(); }
public IApiJob CurrentJob(ReoccurringJob task) { return(new CurrentApiJob(_dataContext, task)); }