Exemplo n.º 1
0
 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"));
 }
Exemplo n.º 2
0
        // 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));
        }
Exemplo n.º 3
0
        // 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));
        }
Exemplo n.º 4
0
        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)));
        }
Exemplo n.º 5
0
        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)));
        }
Exemplo n.º 6
0
        // 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"));
        }
Exemplo n.º 7
0
 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_"));
         }
     }
 }
Exemplo n.º 8
0
        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();
            }
        }