コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            T_DataValue t_DataValue = db.T_DataValue.Find(id);

            db.T_DataValue.Remove(t_DataValue);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Id,T_DataPoint,Value,DateTime")] T_DataValue t_DataValue)
 {
     if (ModelState.IsValid)
     {
         db.Entry(t_DataValue).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.T_DataPoint = new SelectList(db.T_DataPoint, "Id", "Name", t_DataValue.T_DataPoint);
     return(View(t_DataValue));
 }
コード例 #3
0
        // GET: Admin/T_DataValue/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            T_DataValue t_DataValue = db.T_DataValue.Find(id);

            if (t_DataValue == null)
            {
                return(HttpNotFound());
            }
            return(View(t_DataValue));
        }
コード例 #4
0
        private async Task <decimal> TryUpdateDataChart(T_DataPoint point)
        {
            // Randomly choose whether to udpate this stock or not

            var rnd        = new Random();
            var pointValue = new T_DataValue();

            pointValue.Value       = rnd.Next(1, 100);
            pointValue.DateTime    = DateTime.Now;
            pointValue.T_DataPoint = point.Id;
            db.T_DataValue.Add(pointValue);
            await db.SaveChangesAsync();

            return(pointValue.Value);
        }
コード例 #5
0
        // GET: Admin/T_DataValue/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            T_DataValue t_DataValue = db.T_DataValue.Find(id);

            if (t_DataValue == null)
            {
                return(HttpNotFound());
            }
            ViewBag.T_DataPoint = new SelectList(db.T_DataPoint, "Id", "Name", t_DataValue.T_DataPoint);
            return(View(t_DataValue));
        }
コード例 #6
0
        private async void TryUpdateDataChart(List <T_DataPoint> _dataPoints)
        {
            var rnd    = new Random();
            var values = new ReturnChartData();

            // Randomly choose whether to udpate this stock or not
            foreach (var point in _dataPoints)
            {
                var pointValue = new T_DataValue();
                pointValue.Value       = rnd.Next(1, 100);
                pointValue.DateTime    = DateTime.Now;
                pointValue.T_DataPoint = point.Id;
                db.T_DataValue.Add(pointValue);

                values.Values.Add(pointValue.Value);
                values.DateTime = pointValue.DateTime.ToString();
            }
            Clients.Client(_clientId).updateChart(values);
            await db.SaveChangesAsync();
        }