public ActionResult DeleteConfirmed(int id) { Bombona bombona = db.Bombona.Find(id); db.Bombona.Remove(bombona); db.SaveChanges(); TempData["MSG"] = "success|Bombona deletada"; return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Nome,Capacidade,DataInstalacao,LaboratorioId")] Bombona bombona) { if (ModelState.IsValid) { db.Entry(bombona).State = EntityState.Modified; db.SaveChanges(); TempData["MSG"] = "success|Edição realizada"; return(RedirectToAction("Index")); } TempData["MSG"] = "Warning|Edição não realizada"; ViewBag.LaboratorioId = new SelectList(db.Laboratorio, "Id", "Nome", bombona.LaboratorioId); return(View(bombona)); }
public ActionResult Create([Bind(Include = "Id,Nome,Capacidade,DataInstalacao,LaboratorioId")] Bombona bombona) { if (ModelState.IsValid) { bombona.DataInstalacao = DateTime.Now; db.Bombona.Add(bombona); db.SaveChanges(); TempData["MSG"] = "success|Cadastro realizado"; return(RedirectToAction("Index")); } TempData["MSG"] = "Warning|Cadastro não realizado"; ViewBag.LaboratorioId = new SelectList(db.Laboratorio, "Id", "Nome", bombona.LaboratorioId); return(View(bombona)); }
// GET: Bombonas/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Bombona bombona = db.Bombona.Find(id); if (bombona == null) { return(HttpNotFound()); } return(View(bombona)); }
public ActionResult Delete(int id) { Bombona deletarBombona = db.Bombona.Find(id); if (deletarBombona == null) { return(HttpNotFound()); } db.Bombona.Remove(deletarBombona); db.SaveChanges(); TempData["MSG"] = "success|Bombona coletada"; return(RedirectToAction("Index", "EmpresaColeta")); }
// GET: Bombonas/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Bombona bombona = db.Bombona.Find(id); if (bombona == null) { return(HttpNotFound()); } ViewBag.LaboratorioId = new SelectList(db.Laboratorio, "Id", "Nome", bombona.LaboratorioId); return(View(bombona)); }