public void AddSingleStatistic(StatisticDTO item) { using (UsageStatisticsModel db = new UsageStatisticsModel()) { db.UsageStatistics.Add(new UsageStatistics(item)); db.SaveChanges(); } }
public void RemoveLastRow() { using (UsageStatisticsModel db = new UsageStatisticsModel()) { var row = db.UsageStatistics.OrderByDescending(x => x.Time).FirstOrDefault(); if (row != null) { db.UsageStatistics.Remove(row); db.SaveChanges(); } } }