コード例 #1
0
        public string PiSendLOG(String userID, String deviceID)
        {
            if (!String.IsNullOrEmpty(deviceID))
            {
                Device device = db.Devices.Find(deviceID);
                if (device == null || device.device_status == 1)
                {
                    return("log_fail");
                }
            }
            try
            {
                //Log
                Attent atten = new Attent()
                {
                    attent_device = deviceID,
                    attent_user   = userID,
                    attent_time   = DateTime.Now,
                    attent_type   = 0
                };
                db.Attents.Add(atten);
                db.SaveChanges();
            }
            catch
            {
                return("log_fail");
            }

            //save LOG to DB
            return("OK");
            //return "LOG_fail";
        }
コード例 #2
0
ファイル: AttentsController.cs プロジェクト: vagaBond331/FIS
        public ActionResult DeleteConfirmed(string id)
        {
            Attent attent = db.Attents.Find(id);

            db.Attents.Remove(attent);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
ファイル: AttentsController.cs プロジェクト: vagaBond331/FIS
 public ActionResult Edit([Bind(Include = "log_id,user_id,log_time,device_id,log_type,description")] Attent attent)
 {
     if (ModelState.IsValid)
     {
         db.Entry(attent).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(attent));
 }
コード例 #4
0
ファイル: AttentsController.cs プロジェクト: vagaBond331/FIS
        public ActionResult Create([Bind(Include = "log_id,user_id,log_time,device_id,log_type,description")] Attent attent)
        {
            if (ModelState.IsValid)
            {
                db.Attents.Add(attent);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(attent));
        }
コード例 #5
0
ファイル: AttentsController.cs プロジェクト: vagaBond331/FIS
        // GET: Attents/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Attent attent = db.Attents.Find(id);

            if (attent == null)
            {
                return(HttpNotFound());
            }
            return(View(attent));
        }