예제 #1
0
 public static HotSpot GetHotSpot(String BssidToGet)
 {
     HotSpot obj = new HotSpot();
     using (var context = new HotSpotsDBEntities())
     {
         EntityKey key = new EntityKey("HotSpotsDBEntities.HotSpot", "bssid", BssidToGet);
         obj = (HotSpot)context.GetObjectByKey(key);
     }
     return obj;
 }
예제 #2
0
 public static List<HotSpot> GetAllHotSpots()
 {
     List<HotSpot> list = new List<HotSpot>();
     using (var context = new HotSpotsDBEntities())
     {
         var ListOfHotSpots = from item in context.HotSpot select item;
         foreach(HotSpot hotsp in ListOfHotSpots)
         {
             list.Add(hotsp);
         }
     }
     return list;
 }
예제 #3
0
 public static void DeleteHotSpot(String BssidToDelete)
 {
     HotSpot obj = new HotSpot();
     using (var context = new HotSpotsDBEntities())
     {
         EntityKey key = new EntityKey("HotSpotsDBEntities.HotSpot", "bssid", BssidToDelete);
         obj = (HotSpot)context.GetObjectByKey(key);
         if (obj != null)
         {
             context.DeleteObject(obj);
         }
         context.SaveChanges();
     }
 }
예제 #4
0
 public static bool AddHotSpot(HotSpot obj)
 {
     bool success = false;
     using (var context = new HotSpotsDBEntities())
     {
         EntityKey key = new EntityKey("HotSpotsDBEntities.HotSpot", "bssid", obj.bssid);
         if ((HotSpot)context.GetObjectByKey(key) == null)
         {
             context.AddToHotSpot(obj);
             context.SaveChanges();
             success = true;
         }
     }
     return success;
 }