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_/Edit/5 public ActionResult Edit(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(); } return(View(all_beacons_model)); }
// GET: All_beacons_ public ActionResult Index() { List <all_beacons> all_beacons_list = new List <all_beacons>(); using (wardenEntities wardenEntity = new wardenEntities()) { all_beacons_list = wardenEntity.all_beacons.ToList <all_beacons>(); } return(View(all_beacons_list)); }
public ActionResult ListHistory(int?page) { List <history> history_list = new List <history>(); using (wardenEntities wardenEntity = new wardenEntities()) { history_list = wardenEntity.history.ToList <history>(); } int pageSize = 5; int pageNumber = (page ?? 1); return(View(history_list.ToPagedList(pageNumber, pageSize))); }
public ActionResult ListNotif(int?page) { List <notifications> notification_list = new List <notifications>(); using (wardenEntities wardenEntity = new wardenEntities()) { notification_list = wardenEntity.notifications.ToList <notifications>(); } int pageSize = 5; int pageNumber = (page ?? 1); return(View(notification_list.ToPagedList(pageNumber, pageSize))); }
// 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 ActionResult Authorize(login userModel) { using (wardenEntities db = new wardenEntities()) { var details = db.login.Where(x => x.username == userModel.username && x.password == userModel.password).FirstOrDefault(); if (details == null) { return(View("Index", userModel)); } else { Session["username"] = details.username; return(RedirectToAction("Index", "All_beacons_")); } } }
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(); } }