-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Se agrego y configuro para registro de alumnos
- Loading branch information
Angel Arciniega
committed
Mar 3, 2017
1 parent
795ec23
commit dc52170
Showing
14 changed files
with
1,232 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Data; | ||
using System.Data.Entity; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Web; | ||
using System.Web.Mvc; | ||
using Renova.Models; | ||
|
||
namespace RenoEnergy.Controllers | ||
{ | ||
public class alumnoesController : Controller | ||
{ | ||
private RenoContext db = new RenoContext(); | ||
|
||
// GET: alumnoes | ||
public ActionResult Index() | ||
{ | ||
return View(db.alumnos.ToList()); | ||
} | ||
|
||
// GET: alumnoes/Details/5 | ||
public ActionResult Details(int? id) | ||
{ | ||
if (id == null) | ||
{ | ||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest); | ||
} | ||
alumno alumno = db.alumnos.Find(id); | ||
if (alumno == null) | ||
{ | ||
return HttpNotFound(); | ||
} | ||
return View(alumno); | ||
} | ||
|
||
// GET: alumnoes/Create | ||
public ActionResult Create() | ||
{ | ||
return View(); | ||
} | ||
|
||
// POST: alumnoes/Create | ||
// Para protegerse de ataques de publicación excesiva, habilite las propiedades específicas a las que desea enlazarse. Para obtener | ||
// más información vea https://go.microsoft.com/fwlink/?LinkId=317598. | ||
[HttpPost] | ||
[ValidateAntiForgeryToken] | ||
public ActionResult Create([Bind(Include = "IDAlumno,nombre,apellidos,universidad,carrera,matricula,correo,fechareg")] alumno alumno) | ||
{ | ||
if (ModelState.IsValid) | ||
{ | ||
db.alumnos.Add(alumno); | ||
db.SaveChanges(); | ||
return RedirectToAction("Index"); | ||
} | ||
|
||
return View(alumno); | ||
} | ||
|
||
// GET: alumnoes/Edit/5 | ||
public ActionResult Edit(int? id) | ||
{ | ||
if (id == null) | ||
{ | ||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest); | ||
} | ||
alumno alumno = db.alumnos.Find(id); | ||
if (alumno == null) | ||
{ | ||
return HttpNotFound(); | ||
} | ||
return View(alumno); | ||
} | ||
|
||
// POST: alumnoes/Edit/5 | ||
// Para protegerse de ataques de publicación excesiva, habilite las propiedades específicas a las que desea enlazarse. Para obtener | ||
// más información vea https://go.microsoft.com/fwlink/?LinkId=317598. | ||
[HttpPost] | ||
[ValidateAntiForgeryToken] | ||
public ActionResult Edit([Bind(Include = "IDAlumno,nombre,apellidos,universidad,carrera,matricula,correo,fechareg")] alumno alumno) | ||
{ | ||
if (ModelState.IsValid) | ||
{ | ||
db.Entry(alumno).State = EntityState.Modified; | ||
db.SaveChanges(); | ||
return RedirectToAction("Index"); | ||
} | ||
return View(alumno); | ||
} | ||
|
||
// GET: alumnoes/Delete/5 | ||
public ActionResult Delete(int? id) | ||
{ | ||
if (id == null) | ||
{ | ||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest); | ||
} | ||
alumno alumno = db.alumnos.Find(id); | ||
if (alumno == null) | ||
{ | ||
return HttpNotFound(); | ||
} | ||
return View(alumno); | ||
} | ||
|
||
// POST: alumnoes/Delete/5 | ||
[HttpPost, ActionName("Delete")] | ||
[ValidateAntiForgeryToken] | ||
public ActionResult DeleteConfirmed(int id) | ||
{ | ||
alumno alumno = db.alumnos.Find(id); | ||
db.alumnos.Remove(alumno); | ||
db.SaveChanges(); | ||
return RedirectToAction("Index"); | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
if (disposing) | ||
{ | ||
db.Dispose(); | ||
} | ||
base.Dispose(disposing); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Data; | ||
using System.Data.Entity; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Web; | ||
using System.Web.Mvc; | ||
using Renova.Models; | ||
|
||
namespace RenoEnergy.Controllers | ||
{ | ||
public class asistenciasController : Controller | ||
{ | ||
private RenoContext db = new RenoContext(); | ||
|
||
// GET: asistencias | ||
public ActionResult Index() | ||
{ | ||
var asistencias = db.asistencias.Include(a => a.alumno); | ||
return View(asistencias.ToList()); | ||
} | ||
|
||
// GET: asistencias/Details/5 | ||
public ActionResult Details(int? id) | ||
{ | ||
if (id == null) | ||
{ | ||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest); | ||
} | ||
asistencia asistencia = db.asistencias.Find(id); | ||
if (asistencia == null) | ||
{ | ||
return HttpNotFound(); | ||
} | ||
return View(asistencia); | ||
} | ||
|
||
// GET: asistencias/Create | ||
public ActionResult Create() | ||
{ | ||
ViewBag.IDAlumno = new SelectList(db.alumnos, "IDAlumno", "nombre"); | ||
return View(); | ||
} | ||
|
||
// POST: asistencias/Create | ||
// Para protegerse de ataques de publicación excesiva, habilite las propiedades específicas a las que desea enlazarse. Para obtener | ||
// más información vea https://go.microsoft.com/fwlink/?LinkId=317598. | ||
[HttpPost] | ||
[ValidateAntiForgeryToken] | ||
public ActionResult Create([Bind(Include = "IDAsistencia,IDAlumno,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,estado")] asistencia asistencia) | ||
{ | ||
if (ModelState.IsValid) | ||
{ | ||
db.asistencias.Add(asistencia); | ||
db.SaveChanges(); | ||
return RedirectToAction("Index"); | ||
} | ||
|
||
ViewBag.IDAlumno = new SelectList(db.alumnos, "IDAlumno", "nombre", asistencia.IDAlumno); | ||
return View(asistencia); | ||
} | ||
|
||
// GET: asistencias/Edit/5 | ||
public ActionResult Edit(int? id) | ||
{ | ||
if (id == null) | ||
{ | ||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest); | ||
} | ||
asistencia asistencia = db.asistencias.Find(id); | ||
if (asistencia == null) | ||
{ | ||
return HttpNotFound(); | ||
} | ||
ViewBag.IDAlumno = new SelectList(db.alumnos, "IDAlumno", "nombre", asistencia.IDAlumno); | ||
return View(asistencia); | ||
} | ||
|
||
// POST: asistencias/Edit/5 | ||
// Para protegerse de ataques de publicación excesiva, habilite las propiedades específicas a las que desea enlazarse. Para obtener | ||
// más información vea https://go.microsoft.com/fwlink/?LinkId=317598. | ||
[HttpPost] | ||
[ValidateAntiForgeryToken] | ||
public ActionResult Edit([Bind(Include = "IDAsistencia,IDAlumno,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,estado")] asistencia asistencia) | ||
{ | ||
if (ModelState.IsValid) | ||
{ | ||
db.Entry(asistencia).State = EntityState.Modified; | ||
db.SaveChanges(); | ||
return RedirectToAction("Index"); | ||
} | ||
ViewBag.IDAlumno = new SelectList(db.alumnos, "IDAlumno", "nombre", asistencia.IDAlumno); | ||
return View(asistencia); | ||
} | ||
|
||
// GET: asistencias/Delete/5 | ||
public ActionResult Delete(int? id) | ||
{ | ||
if (id == null) | ||
{ | ||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest); | ||
} | ||
asistencia asistencia = db.asistencias.Find(id); | ||
if (asistencia == null) | ||
{ | ||
return HttpNotFound(); | ||
} | ||
return View(asistencia); | ||
} | ||
|
||
// POST: asistencias/Delete/5 | ||
[HttpPost, ActionName("Delete")] | ||
[ValidateAntiForgeryToken] | ||
public ActionResult DeleteConfirmed(int id) | ||
{ | ||
asistencia asistencia = db.asistencias.Find(id); | ||
db.asistencias.Remove(asistencia); | ||
db.SaveChanges(); | ||
return RedirectToAction("Index"); | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
if (disposing) | ||
{ | ||
db.Dispose(); | ||
} | ||
base.Dispose(disposing); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.