public void DeleteTimeEntry(TimeEntry timeEntry) { _context.DeleteEntity(timeEntry); }
public void SaveTimeEntry(TimeEntry timeEntry, User user) { // if the user is using the stopwatch approach to time entry... if (user.UseStopwatchApproachToTimeEntry) { // if there's a time entry that doesn't have a time out value // then update it to the new time entry's time in value var lastTimeEntry = (from te in _context.TimeEntries where te.UserId == user.UserId && te.TimeEntryId != timeEntry.TimeEntryId && te.TimeOutUtc == null && te.TimeInUtc < timeEntry.TimeInUtc orderby te.TimeInUtc descending select te).FirstOrDefault(); if (lastTimeEntry != null) lastTimeEntry.TimeOutUtc = timeEntry.TimeInUtc; } _context.SaveEntity(timeEntry); }