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")); }
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)); }
// 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)); }
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); }
// 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)); }
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(); }