public ActionResult DenunciarFoco(string txtEndereco, string txtBairro, string txtDescricao, string txtDoentes) { FocoDengue f = new FocoDengue { Usuario = "Anonimo", Endereco = txtEndereco, Bairro = txtBairro, Descricao = txtDescricao, Doentes = txtDoentes }; if (DenunciaDAO.DenunciarFoco(f)) { return(RedirectToAction("Index", "Denuncia")); } //if (DenunciaDAO.BuscarUsuarioporNome(txtNomeUsuario) == null && UsuarioDAO.BuscarUsuarioporCPF(u) == null) //{ // DenunciaDAO.DenunciarFoco(f); //return RedirectToAction("Index", "Home"); //} else { return(View()); } }
public static bool DenunciarFoco(FocoDengue f) { if (BuscarFocoDengueporID(f) == null) { ctx.FocoDengues.Add(f); ctx.SaveChanges(); return(true); } return(false); }
public static void AlterarFoco(FocoDengue f) { ctx.Entry(f).State = System.Data.Entity.EntityState.Modified; ctx.SaveChanges(); }
public static void RemoverFoco(FocoDengue f) { ctx.FocoDengues.Remove(f); ctx.SaveChanges(); }
public static FocoDengue BuscarFocoDengueporID(FocoDengue f) { return(ctx.FocoDengues.FirstOrDefault(x => x.FocoId.Equals(f.FocoId))); }