예제 #1
0
        private async Task RecordUsage()
        {
            var utcNow = DateTimeOffset.UtcNow;

            // We only have to record usage once per calendar day.
            if (_lastRecordedUsage == null || _lastRecordedUsage?.DayOfYear != utcNow.DayOfYear)
            {
                using (var context = new ShipHubContext()) {
                    await context.RecordUsage(_user.UserId, utcNow);
                }
                _lastRecordedUsage = utcNow;
            }
        }