public ActionResult DeleteConfirmed(int id) { LogsViewModels logsViewModels = db.LogsViewModels.Find(id); db.LogsViewModels.Remove(logsViewModels); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "CameraId,Date,Email,Status,IPAddress")] LogsViewModels logsViewModels) { if (ModelState.IsValid) { db.Entry(logsViewModels).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(logsViewModels)); }
public ActionResult Create([Bind(Include = "CameraId,Date,Email,Status,IPAddress")] LogsViewModels logsViewModels) { if (ModelState.IsValid) { db.LogsViewModels.Add(logsViewModels); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(logsViewModels)); }
// GET: Logs/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LogsViewModels logsViewModels = db.LogsViewModels.Find(id); if (logsViewModels == null) { return(HttpNotFound()); } return(View(logsViewModels)); }
public ActionResult MostrarGraficoPersonalizado() { List <LogsViewModels> MeusLogs = new List <LogsViewModels>(); //Preenchendo qualquer dado para exibir no gráfico //Substitua por seu método para buscar as informações e preenchar a model Random rand = new Random(); for (int i = 0; i < 20; i++) { LogsViewModels auxLog = new LogsViewModels(); auxLog.CodigoLog = i; auxLog.Dia = DateTime.Now.AddMonths(rand.Next(5)).AddDays(i).AddSeconds(rand.Next(1000)).AddMinutes(rand.Next(60)); auxLog.QtdeAcessos = i + rand.Next(200); MeusLogs.Add(auxLog); } Chart chart = MostrarGrafico(MeusLogs); MemoryStream ms = new MemoryStream(); chart.SaveImage(ms); return(File(ms.GetBuffer(), @"image/png")); }