public ActionResult DeleteConfirmed(int id) { ModTelefone modTelefone = db.ModTelefones.Find(id); db.ModTelefones.Remove(modTelefone); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ModTelefoneID,Modelo,FabricanteID,FornecedorID")] ModTelefone modTelefone) { if (ModelState.IsValid) { db.Entry(modTelefone).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.FabricanteID = new SelectList(db.Fabricantes, "IdFabricante", "Nome", modTelefone.FabricanteID); ViewBag.FornecedorID = new SelectList(db.Fornecedors, "FornecedorID", "Nome", modTelefone.FornecedorID); return(View(modTelefone)); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ModTelefone modTelefone = db.ModTelefones.Find(id); if (modTelefone == null) { return(HttpNotFound()); } return(View(modTelefone)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ModTelefone modTelefone = db.ModTelefones.Find(id); if (modTelefone == null) { return(HttpNotFound()); } ViewBag.FabricanteID = new SelectList(db.Fabricantes, "IdFabricante", "Nome", modTelefone.FabricanteID); ViewBag.FornecedorID = new SelectList(db.Fornecedors, "FornecedorID", "Nome", modTelefone.FornecedorID); return(View(modTelefone)); }