예제 #1
0
        public ActionResult Cliente()
        {
            ViewBag.Title = "Clientes";
            List <Cliente> cliente = DALittlePets.ObtenerCliente();

            return(View("Cliente", cliente));
        }
예제 #2
0
        public ActionResult ActualizarInventario(string idProducto, string cantidad, string inventario, string accion)
        {
            int total = 0;

            if (accion == "inventario")
            {
                total = Int32.Parse(inventario) + Int32.Parse(cantidad);
            }
            else
            {
                total = Int32.Parse(inventario) - Int32.Parse(cantidad);
            }

            string data;

            try
            {
                DALittlePets.ActualizarInventario(Int32.Parse(idProducto), total);
                return(Json(new { title = "¡Actualización exitosa!" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json(new { title = "Error", data = e.Message }, JsonRequestBehavior.AllowGet));
            }
        }
예제 #3
0
        //public ActionResult ObtenerMascota()
        //{
        //    ViewBag.Message = "Mascotas";
        //    List<Mascota> mascota = new List<Mascota>();
        //    mascota = DALittlePets.ObtenerMascota();
        //    return View("Mascota", mascota);
        //}

        public ActionResult ObtenerMascotaDetalle(int idmascota)
        {
            MascotaDetalle mascota = new MascotaDetalle();

            mascota = DALittlePets.ObtenerMascotaDetalle(idmascota);
            return(View("MascotaDetalle", mascota));
        }
예제 #4
0
        public ActionResult EliminarCliente(int idcliente)
        {
            ViewBag.Title = "Clientes";
            DALittlePets.EliminarCliente(idcliente);
            List <Cliente> cliente = DALittlePets.ObtenerCliente();

            return(View("Cliente", cliente));
        }
예제 #5
0
        public ActionResult ObtenerMascotaDetalle(string idmascota)
        {
            int            idMascota = Convert.ToInt32(idmascota);
            MascotaDetalle mascota   = new MascotaDetalle();

            mascota = DALittlePets.ObtenerMascotaDetalle(idMascota);
            return(View("MascotaDetalle", mascota));
        }
예제 #6
0
        public ActionResult AgregarCliente(string nombre, string direccion, string telefono, string email)
        {
            ViewBag.Title = "Clientes";
            DALittlePets.AgregarCliente(nombre, direccion, telefono, email);
            List <Cliente> cliente = DALittlePets.ObtenerCliente();

            return(View("Cliente", cliente));
        }
예제 #7
0
        public ActionResult BuscarMascota(string nombre)
        {
            ViewBag.Title  = "Resultados";
            ViewBag.Opcion = "Encontradas";
            List <Mascota> mascota = new List <Mascota>();

            mascota = DALittlePets.BuscarMascota(nombre);
            return(View("Mascota", mascota));
        }
예제 #8
0
        // GET: Principal
        public ActionResult Index()
        {
            ViewBag.Title  = "Mascotas";
            ViewBag.Opcion = "Registradas";
            List <Mascota> mascota = new List <Mascota>();

            mascota = DALittlePets.ObtenerMascota();
            return(View("Mascota", mascota));
        }
예제 #9
0
        public ActionResult AgregarMascotaDB(string duenio, string nombre, int cuidador, string especie, string raza, string color, float peso, string sexo, string nacimiento)
        {
            ViewBag.Title  = "Mascotas";
            ViewBag.Opcion = "Registradas";
            DALittlePets.AgregarMascota(duenio, nombre, cuidador, especie, raza, color, peso, sexo, nacimiento);
            List <Mascota> mascota = new List <Mascota>();

            mascota = DALittlePets.ObtenerMascota();
            return(View("Mascota", mascota));
        }
예제 #10
0
        public ActionResult EliminarMascota(int idmascota)
        {
            ViewBag.Title  = "Mascotas";
            ViewBag.Opcion = "Registradas";
            DALittlePets.EliminarMascota(idmascota);
            List <Mascota> mascota = new List <Mascota>();

            mascota = DALittlePets.ObtenerMascota();
            return(View("Mascota", mascota));
        }
예제 #11
0
        public ActionResult EditarMascota(string idmascota, string color, float peso)
        {
            int Idmascota = Convert.ToInt32(idmascota);

            DALittlePets.EditarMascota(Idmascota, color, peso);

            ViewBag.Title  = "Mascotas";
            ViewBag.Opcion = "Registradas";
            List <Mascota> mascota = new List <Mascota>();

            mascota = DALittlePets.ObtenerMascota();
            return(View("Mascota", mascota));
        }
예제 #12
0
        public ActionResult ActualizarProductos()
        {
            List <Producto> productos = new List <Producto>();

            productos = DALittlePets.ObtenerProductos();
            if (productos == null)
            {
                productos = new List <Producto>();
                Producto vacio = new Producto();
                vacio.IdProducto = 123;
                vacio.Nombre     = "Vacio";
                vacio.Precio     = 123;
                vacio.Cantidad   = 9;
                productos.Add(vacio);
            }
            return(Json(new { data = RenderRazorViewToString("~/Views/Home/_ProductosParciales.cshtml", productos) }, JsonRequestBehavior.AllowGet));
        }
예제 #13
0
        public ActionResult Productos()
        {
            List <Producto> productos = new List <Producto>();

            ViewBag.Title   = "Productos LittlePets";
            ViewBag.Message = "Inventario";
            productos       = DALittlePets.ObtenerProductos();
            if (productos == null)
            {
                productos = new List <Producto>();
                Producto vacio = new Producto();
                vacio.IdProducto = 123;
                vacio.Nombre     = "Vacio";
                vacio.Precio     = 123;
                vacio.Cantidad   = 9;
                productos.Add(vacio);
            }
            return(PartialView("Productos", productos));
        }
예제 #14
0
        // GET: Principal
        public ActionResult Index()
        {
            ViewBag.Message = "Mascotas";
            List <Mascota> mascotas = new List <Mascota>();

            mascotas = DALittlePets.ObtenerMascota();
            if (mascotas == null)
            {
                mascotas = new List <Mascota>();
                Mascota vacio = new Mascota();
                vacio.IdMascota = 123;
                vacio.Dueño     = "ABC";
                vacio.Nombre    = "DEF";
                vacio.Especie   = "ABGHIC";
                vacio.Raza      = "ZXCV";
                mascotas.Add(vacio);
            }
            return(View("Mascota", mascotas));
        }
예제 #15
0
        public ActionResult Analisis()
        {
            List <Analisis> analisis = new List <Analisis>();

            analisis = DALittlePets.ObtenerAnalisis();
            if (analisis == null)
            {
                CentroEstudio centro = new CentroEstudio();

                analisis = new List <Analisis>();
                Analisis vacio = new Analisis();
                vacio.IdAnalisis = 123;
                vacio.Nombre     = "Vacio";
                vacio.Precio     = 0;
                vacio.Centro     = "VACIO";
                vacio.Domicilio  = "VACIO";
                vacio.Telefono   = "VACIO";
                analisis.Add(vacio);
            }

            return(View(analisis));
        }