public ActionResult DeleteConfirmed(int id) { DobradorModel dobradorModel = db.Dobradores.Find(id); db.Dobradores.Remove(dobradorModel); db.SaveChanges(); return(RedirectToAction(nameof(Index))); }
public ActionResult Edit(DobradorModel dobradorModel) { if (ModelState.IsValid) { db.Entry(dobradorModel).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction(nameof(Index))); } ViewBag.EquipeId = new SelectList(db.Equipes, "Id", "Equipe", dobradorModel.EquipeId); return(View(dobradorModel)); }
public ActionResult Create(DobradorModel dobradorModel) { if (ModelState.IsValid) { db.Dobradores.Add(dobradorModel); db.SaveChanges(); return(RedirectToAction(nameof(Index))); } ViewBag.EquipeId = new SelectList(db.Equipes, "Id", "Equipe", dobradorModel.EquipeId); return(View(dobradorModel)); }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest)); } DobradorModel dobradorModel = db.Dobradores.Include(e => e.Equipe).First(d => d.Id == id); if (dobradorModel == null) { return(HttpNotFound()); } return(View(dobradorModel)); }
//GET: Edit public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest)); } DobradorModel dobradorModel = db.Dobradores.Find(id); if (dobradorModel == null) { return(HttpNotFound()); } ViewBag.EquipeId = new SelectList(db.Equipes, "Id", "Equipe", dobradorModel.EquipeId); return(View(dobradorModel)); }