public void EnsureSeedData() { if (!_context.Beacons.Any()) { // Add new data var beacon = new Beacon() { UUID = "f7826da6-4fa2-4e98-8024-bc5b71e0893e", Major = "5262", Minor = "65087", FarMessage = "Hi, you are far!", NearMessage = "Hi, you are near!", ImmediateMessage = "Hi, you are immediate!" }; _context.Beacons.Add(beacon); _context.SaveChanges(); } }
public void Delete(Beacon beacon) { _context.Beacons.Remove(beacon); _context.SaveChanges(); }
public void AddBeacon(Beacon beacon) { _context.Beacons.Add(beacon); _context.SaveChanges(); }
public void Edit(Beacon beacon) { _context.Entry<Beacon>(beacon).State = EntityState.Modified; var beaconToUpdate = _context.Beacons.Where(b => b.Id == beacon.Id).FirstOrDefault(); _context.SaveChanges(); }