public ActionResult Create(all_beacons all_beacons_model) { using (wardenEntities wardenEntity = new wardenEntities()) { wardenEntity.all_beacons.Add(all_beacons_model); wardenEntity.SaveChanges(); } return(RedirectToAction("Index")); }
// GET: All_beacons_/Delete/5 public ActionResult Delete(int id) { all_beacons all_beacons_model = new all_beacons(); using (wardenEntities wardenEntity = new wardenEntities()) { all_beacons_model = wardenEntity.all_beacons.Where(x => x.idb == id).FirstOrDefault(); wardenEntity.Entry <all_beacons>(all_beacons_model).State = EntityState.Modified; wardenEntity.Entry <active_beacons>(all_beacons_model.active_beacons).State = EntityState.Deleted; wardenEntity.SaveChanges(); } return(RedirectToAction("Index")); }
public void Seen(int id) { notifications notification = new notifications(); history h = new history(); using (wardenEntities wardenEntity = new wardenEntities()) { notification = wardenEntity.notifications.Where(x => x.idn == id).FirstOrDefault(); wardenEntity.notifications.Remove(notification); h.idn = id; h.idb = notification.idb; h.ninfo = notification.ninfo; h.ntype = notification.ntype; h.status = this.HttpContext.User.Identity.Name; h.time = notification.time; wardenEntity.history.Add(h); wardenEntity.SaveChanges(); } }