public ActionResult DeleteConfirmed(int id) { Sugesto sugesto = pnSugestoes.Pesquisar(id); pnSugestoes.Excluir(sugesto); return(RedirectToAction("Index")); }
// GET: Sugestoes/Delete/5 public ActionResult Delete(int id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Sugesto sugesto = pnSugestoes.Pesquisar(id); if (sugesto == null) { return(HttpNotFound()); } return(View(sugesto)); }
public ActionResult Create([Bind(Include = "titulo,descricao")] Sugesto s) { if (ModelState.IsValid) { try { s.Usuario_email = System.Web.HttpContext.Current.Session["email"].ToString(); pnSugestoes.Inserir(s, null); return(RedirectToAction("Index", "Eventoes")); } catch (Exception) { } } return(View()); }
public static Sugesto Pesquisar(int id) { try { dbEventosEntities db = new dbEventosEntities(); Sugesto cat = new Sugesto(); //u.email = email; cat = db.Sugestoes.Find(id); return(cat); } catch (Exception) { throw; } }
public static bool Excluir(Sugesto c) { try { dbEventosEntities db = new dbEventosEntities(); Sugesto cat = new Sugesto(); cat = db.Sugestoes.Find(c.Id); db.Sugestoes.Remove(cat); db.SaveChanges(); return(true); } catch (Exception) { throw; } }
public static bool Inserir(Sugesto s, dbEventosEntities db) { try { if (db == null) { db = new dbEventosEntities(); } s.data_criacao = (DateTime.Now).Date; s.Id = getLasId(); db.Sugestoes.Add(s); db.SaveChanges(); return(true); } catch (Exception) { throw; } }