コード例 #1
0
        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());
            }
        }
コード例 #2
0
 public static bool DenunciarFoco(FocoDengue f)
 {
     if (BuscarFocoDengueporID(f) == null)
     {
         ctx.FocoDengues.Add(f);
         ctx.SaveChanges();
         return(true);
     }
     return(false);
 }
コード例 #3
0
 public static void AlterarFoco(FocoDengue f)
 {
     ctx.Entry(f).State = System.Data.Entity.EntityState.Modified;
     ctx.SaveChanges();
 }
コード例 #4
0
 public static void RemoverFoco(FocoDengue f)
 {
     ctx.FocoDengues.Remove(f);
     ctx.SaveChanges();
 }
コード例 #5
0
 public static FocoDengue BuscarFocoDengueporID(FocoDengue f)
 {
     return(ctx.FocoDengues.FirstOrDefault(x => x.FocoId.Equals(f.FocoId)));
 }