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(); }
public async Task StoreEndpointAsync(Endpoint endpoint) { await _context.Endpoints.AddAsync(endpoint); await _context.SaveChangesAsync(); }