public ActionResult DeleteConfirmed(int id)
        {
            WatchLog watchLog = db.WatchLogs.Find(id);

            db.WatchLogs.Remove(watchLog);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Id,LogCode,LogDate,Robot,LogMsg")] WatchLog watchLog)
 {
     if (ModelState.IsValid)
     {
         db.Entry(watchLog).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(watchLog));
 }
        public ActionResult Create([Bind(Include = "Id,LogCode,LogDate,Robot,LogMsg")] WatchLog watchLog)
        {
            if (ModelState.IsValid)
            {
                db.WatchLogs.Add(watchLog);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(watchLog));
        }
Ejemplo n.º 4
0
 public int Add(WatchLog model)
 {
     lock (locker)
     {
         if (cnt > list.Length - 1)
         {
             cnt = 0; // first in first out
         }
         list[cnt++] = model;
     }
     return(1);
 }
Ejemplo n.º 5
0
        public void TestMethod2()
        {
            IList <WatchLog> logs = new List <WatchLog>();
            WatchLog         log  = new WatchLog();

            log.Name = "a";
            log.Date = DateTime.Now;

            logs.Add(log);
            string json = WatchLog.Save(logs);

            var obj = WatchLog.Load(json);
        }
        // GET: WatchLogs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WatchLog watchLog = db.WatchLogs.Find(id);

            if (watchLog == null)
            {
                return(HttpNotFound());
            }
            return(View(watchLog));
        }
Ejemplo n.º 7
0
 public void Stop(string requestUrl)
 {
     if (stopwatch != null)
     {
         stopwatch.Stop();
         var model = new WatchLog()
         {
             Url          = requestUrl,
             Milliseconds = stopwatch.ElapsedMilliseconds,
             Ticks        = stopwatch.ElapsedTicks
         };
         iStore.Add(model);
         stopwatch = null;
     }
 }