public ActionResult Deletar(Inscricao collection) { var teste = _Context.Inscricoes.Where(i => i.Id == collection.Id).First(); _Context.Inscricoes.Remove(teste); _Context.SaveChanges(); return RedirectToAction("Listar"); }
public ActionResult Create(Inscricao collection) { if (collection != null) { _Context.Inscricoes.Add(collection); _Context.SaveChanges(); return RedirectToAction("TelaConfirmacao", new { inscricaoComSucesso = true }); } return View(collection); }
public ActionResult Editar(Inscricao collection) { Inscricao inscrito = _Context.Inscricoes.Find(collection.Id); if (inscrito.tipoInsccricao != collection.tipoInsccricao) inscrito.tipoInsccricao = collection.tipoInsccricao; if (inscrito.nome != collection.nome) inscrito.nome = collection.nome; if (inscrito.instituicao != collection.instituicao) inscrito.instituicao = collection.instituicao; if (inscrito.email != collection.email) inscrito.email = collection.email; if (inscrito.telefone != collection.telefone) inscrito.telefone = collection.telefone; if (inscrito.curso != collection.curso) inscrito.curso = collection.curso; _Context.SaveChanges(); return RedirectToAction("Listar"); }
public ActionResult Index(Inscricao collection) { if (collection != null) { _Context.Inscricoes.Add(collection); _Context.SaveChanges(); if (Request.IsAuthenticated) return RedirectToAction("Listar"); else return RedirectToAction("TelaConfirmacao", new { inscricaoComSucesso = true }); } return View(collection); }