protected static bool isNotAffected(DateTime D) { using (var ctx = new TaxiTraficEntities()) { AffectedDay x = ctx.AffectedDays.Where(a => a.ID == 1).FirstOrDefault(); return((x == null) || (x.AFFECTED < D.Date)); } }
protected static void AssignmentOLD(DateTime D) { using (var ctx = new TaxiTraficEntities()) { AffectedDay x = ctx.AffectedDays.Where(a => a.ID == 1).FirstOrDefault(); if (x != null) { x.AFFECTED = D.AddDays(-1); } else { x = new AffectedDay(); x.AFFECTED = D.AddDays(-1); ctx.AffectedDays.Add(x); } ctx.SaveChanges(); } }