Exemple #1
0
 public static Switch Last()
 {
     using (IoTdbContext db = new IoTdbContext())
     {
         return(db.Switch.OrderByDescending(s => s.ID).FirstOrDefault());
     }
 }
Exemple #2
0
 public static List <Switch> GetAll()
 {
     using (IoTdbContext db = new IoTdbContext())
     {
         return(db.Switch.ToList());
     }
 }
Exemple #3
0
 public static void Add(Switch sw)
 {
     using (IoTdbContext db = new IoTdbContext())
     {
         sw.Date = DateTime.Now;
         db.Switch.Add(sw);
         db.SaveChanges();
     }
 }