public void SetInterrupted(WorkTime workTime) { workTime.TakeSnapshot(); workTime.SetInterrupted(); _repository.Save(workTime); workTime.MarkPendingEventsAsHandled(); }
public WorkTime CreateStartedManually(User.User user, DateTime endDate, bool start = false) { if (endDate <= InternalTimeService.GetCurrentDateTime()) { throw new ArgumentException("Invalid end date"); } var id = _idGenerator.GenerateId(); //todo long var workTime = new WorkTime(id, user, null, endDate); if (start) { workTime.StartManually(); } _repository.Save(workTime); workTime.MarkPendingEventsAsHandled(); return(workTime); }