public ActionResult DeleteConfirmed(int id) { PcConfig pcConfig = db.Configs.Find(id); db.Configs.Remove(pcConfig); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: PcConfig/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PcConfig pcConfig = db.Configs.Find(id); if (pcConfig == null) { return(HttpNotFound()); } return(View(pcConfig)); }
public ActionResult Edit([Bind(Include = "Id,Nome,ProcessadorID,PlacaMaeID,PlacaVideoID,MemoriaID,SSDID,DiscoRigidoID,GabineteID,CpuCoolerID,SistemaOperacionalID,FonteID, tipo")] PcConfig pcConfig) { if (ModelState.IsValid) { db.Entry(pcConfig).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CpuCoolerID = new SelectList(db.CpuCoolers, "Id", "Nome", pcConfig.CpuCoolerID); ViewBag.DiscoRigidoID = new SelectList(db.DiscoRigidoes, "Id", "Nome", pcConfig.DiscoRigidoID); ViewBag.FonteID = new SelectList(db.Fontes, "Id", "Nome", pcConfig.FonteID); ViewBag.GabineteID = new SelectList(db.Gabinetes, "Id", "Nome", pcConfig.GabineteID); ViewBag.MemoriaID = new SelectList(db.Memorias, "Id", "Nome", pcConfig.MemoriaID); ViewBag.PlacaMaeID = new SelectList(db.PlacaMaes, "Id", "Nome", pcConfig.PlacaMaeID); ViewBag.PlacaVideoID = new SelectList(db.PlacaVideos, "Id", "Nome", pcConfig.PlacaVideoID); ViewBag.ProcessadorID = new SelectList(db.Processadors, "Id", "Nome", pcConfig.ProcessadorID); ViewBag.SistemaOperacionalID = new SelectList(db.SistemaOperacionals, "Id", "Nome", pcConfig.SistemaOperacionalID); ViewBag.SSDID = new SelectList(db.SSDs, "Id", "Nome", pcConfig.SSDID); return(View(pcConfig)); }
// GET: PcConfig/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PcConfig pcConfig = db.Configs.Find(id); if (pcConfig == null) { return(HttpNotFound()); } ViewBag.CpuCoolerID = new SelectList(db.CpuCoolers, "Id", "Nome", pcConfig.CpuCoolerID); ViewBag.DiscoRigidoID = new SelectList(db.DiscoRigidoes, "Id", "Nome", pcConfig.DiscoRigidoID); ViewBag.FonteID = new SelectList(db.Fontes, "Id", "Nome", pcConfig.FonteID); ViewBag.GabineteID = new SelectList(db.Gabinetes, "Id", "Nome", pcConfig.GabineteID); ViewBag.MemoriaID = new SelectList(db.Memorias, "Id", "Nome", pcConfig.MemoriaID); ViewBag.PlacaMaeID = new SelectList(db.PlacaMaes, "Id", "Nome", pcConfig.PlacaMaeID); ViewBag.PlacaVideoID = new SelectList(db.PlacaVideos, "Id", "Nome", pcConfig.PlacaVideoID); ViewBag.ProcessadorID = new SelectList(db.Processadors, "Id", "Nome", pcConfig.ProcessadorID); ViewBag.SistemaOperacionalID = new SelectList(db.SistemaOperacionals, "Id", "Nome", pcConfig.SistemaOperacionalID); ViewBag.SSDID = new SelectList(db.SSDs, "Id", "Nome", pcConfig.SSDID); return(View(pcConfig)); }