예제 #1
0
        public async Task RemoveEndpointStatsByDaysToKeep(int daysToKeep)
        {
            await using var context = new EpMonContext();

            var minDate = DateTime.UtcNow.AddDays(-daysToKeep);

            await context.Database.ExecuteSqlRawAsync($"DELETE FROM EndpointStats WHERE TimeStamp <= '{minDate.ToString("yyyy-MM-dd HH:mm:ss")}'");

            await context.SaveChangesAsync();
        }
예제 #2
0
        public async Task StoreEndpointAsync(Endpoint endpoint)
        {
            await _context.Endpoints.AddAsync(endpoint);

            await _context.SaveChangesAsync();
        }