public void SaveHistory(string hangfireId, string message, DateTime startDate) { HangfireHistory history = HangfireHistory.Create(hangfireId, message, startDate); HangfireHistories.Add(history); SaveChanges(); }
public static HangfireHistory Create(string hangfireId, string message, DateTime startDate) { DateTime today = DateTime.Now; HangfireHistory result = new HangfireHistory { Duration = (int)(today - startDate).TotalSeconds, HangfireId = hangfireId, Message = message, StartTime = startDate }; return(result); }