public ActionResult Edit([Bind(Include = "Id, Nome")] evento_composto evento_composto) { if (ModelState.IsValid) { pnEventosCompostos.Editar(evento_composto); return(RedirectToAction("Index")); } return(View(evento_composto)); }
public ActionResult Create([Bind(Include = "Nome")] evento_composto evento_composto) { if (ModelState.IsValid) { pnEventosCompostos.Cadastrar(evento_composto); return(RedirectToAction("Index")); } return(View(evento_composto)); }
public static void Editar(evento_composto ec) { try { EventosEntities db = new EventosEntities(); db.Entry(ec).State = EntityState.Modified; db.SaveChanges(); } catch (Exception) { throw; } }
public static void Cadastrar(evento_composto ec) { try { EventosEntities db = new EventosEntities(); db.evento_composto.Add(ec); db.SaveChanges(); } catch (Exception) { throw; } }
// GET: evento_composto/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } evento_composto evento_composto = pnEventosCompostos.Procurar(id); if (evento_composto == null) { return(HttpNotFound()); } return(View(evento_composto)); }
public static evento_composto Procurar(int?id) { try { EventosEntities db = new EventosEntities(); evento_composto u = db.evento_composto.Find(id); if (u == null) { return(null); } return(u); } catch (Exception) { throw; } }