public ActionResult DeleteConfirmed(int id) { CpuCooler cpuCooler = db.CpuCoolers.Find(id); db.CpuCoolers.Remove(cpuCooler); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Nome,Descricao,Marca,PrecoMedio,ConsumoWatts,Link")] CpuCooler cpuCooler) { if (ModelState.IsValid) { db.Entry(cpuCooler).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cpuCooler)); }
public ActionResult Create([Bind(Include = "Id,Nome,Descricao,Marca,PrecoMedio,ConsumoWatts,Link")] CpuCooler cpuCooler) { if (ModelState.IsValid) { db.CpuCoolers.Add(cpuCooler); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cpuCooler)); }
// GET: CpuCooler/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CpuCooler cpuCooler = db.CpuCoolers.Find(id); if (cpuCooler == null) { return(HttpNotFound()); } return(View(cpuCooler)); }