Example #1
0
        public ActionResult Adoptar()
        {
            ViewBag.Message = "Encuentra tu Mascota Ideal";
            DAL.Mascota    sdb      = new DAL.Mascota();
            List <Mascota> mascotas = sdb.ObtenerMascotas();

            return(View(mascotas));
        }
        public ActionResult Contact(Mascota mascota)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    DAL.Mascota sdb = new DAL.Mascota();
                    if (sdb.AgregarMascota(mascota))
                    {
                        ViewBag.Message = "Gracias por registrar a " + mascota.Nombre;
                        ModelState.Clear();
                    }
                }
            }
            catch
            {
                ViewBag.Message = "Error al registrar mascota";
            }

            return(View());
        }