public ActionResult Delete(int id) { Models.Estudante estudante = db.Estudante.Find(id); db.Estudante.Remove(estudante); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(Models.Estudante estudante) { if (ModelState.IsValid) { db.Entry(estudante).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(estudante)); }
public ActionResult Create(Models.Estudante estudante) { if (ModelState.IsValid) { db.Estudante.Add(estudante); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(estudante)); }
public ActionResult Edit(int?id) { if (!id.HasValue) { return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest)); } Models.Estudante estudante = db.Estudante.Find(id); if (estudante == null) { return(HttpNotFound()); } return(View(estudante)); }