public void CheckOut() { if (Tick.simulatorDate.Hour == 17) { var hamsterList = hamsterService.GetAll(); foreach (var hamster in hamsterList) { var lastActivity = hamster.ActivityLogs.Last(); lastActivity.EndTime = Tick.simulatorDate; activityLogService.Update(lastActivity); activityLogService.Add( new ActivityLog { HamsterId = hamster.Id, ActivityId = (int)ActivityType.Left, StartTime = Tick.simulatorDate, EndTime = Tick.simulatorDate }); } var areas = areaService.GetAll(); foreach (var area in areas) { area.StatusId = (int)Status.Available; areaService.Update(area); } } }