public static StartTimeEntryEvent With(TimeEntryStartOrigin origin, ITimeEntry timeEntry) => new StartTimeEntryEvent( origin, string.IsNullOrWhiteSpace(timeEntry.Description), timeEntry.ProjectId != null, timeEntry.TaskId != null, timeEntry.TagIds.Count(), timeEntry.Billable, timeEntry.IsRunning());
public static DateTimeOffset?StopTime(this ITimeEntry timeEntry) => timeEntry.IsRunning() ? (DateTimeOffset?)null : timeEntry.Start + timeEntry.TimeSpanDuration().Value;