public async Task <int> AddHistory(int id) { BackupJobHistory history = new BackupJobHistory(); history.Job = new BackupJob { ID = id }; history.Started = DateTime.Now; context.JobHistory.Add(history); await context.SaveChangesAsync(); return(history.ID); }
public async Task <bool> UpdateHistory(int historyId, ExitCode status, string message) { BackupJobHistory history = await context.JobHistory.FirstOrDefaultAsync(jh => jh.ID == historyId); if (history == null) { return(false); } history.Completed = DateTime.Now; history.Message = message; history.Status = status; await context.SaveChangesAsync(); return(true); }