public void Add(MOE.Common.Models.DetectionHardware DetectionHardware)
 {
     MOE.Common.Models.DetectionHardware g = (from r in db.DetectionHardwares
                                              where r.ID == DetectionHardware.ID
                                              select r).FirstOrDefault();
     if (g == null)
     {
         db.DetectionHardwares.Add(g);
         db.SaveChanges();
     }
 }
 public void Update(MOE.Common.Models.DetectionHardware DetectionHardware)
 {
     MOE.Common.Models.DetectionHardware g = (from r in db.DetectionHardwares
                                              where r.ID == DetectionHardware.ID
                                              select r).FirstOrDefault();
     if (g != null)
     {
         db.Entry(g).CurrentValues.SetValues(DetectionHardware);
         db.SaveChanges();
     }
     else
     {
         db.DetectionHardwares.Add(DetectionHardware);
         db.SaveChanges();
     }
 }