public bool DumpOneStat() { var stat = AlarmStats.Pop(); if (stat == null) { throw new NullReferenceException("alarm stat is null!"); } var item = _repository.FirstOrDefault( x => x.HappenTime == stat.HappenTime && x.ENodebId == stat.ENodebId && x.SectorId == stat.SectorId && x.AlarmId == stat.AlarmId); if (item == null) { _repository.Insert(stat); } else { item.RecoverTime = stat.RecoverTime; } _repository.SaveChanges(); return(true); }