Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            LogsViewModels logsViewModels = db.LogsViewModels.Find(id);

            db.LogsViewModels.Remove(logsViewModels);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 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));
 }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        // 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));
        }
Exemplo n.º 5
0
        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"));
        }