Exemple #1
0
        public ActionResult GrabarCategoriaC(CategoriaCaracteristica x, string Accion)
        {
            ViewBag.Accion = Accion;
            if (!ModelState.IsValid)
            {
                return(View("FormCategoriaC", x));
            }
            else
            {
                switch (Accion)
                {
                case "Insertar":
                    Conexion.InsertarCategoriaC(x);
                    break;

                case "Editar":
                    Conexion.ModificarCategoriaC(x);
                    break;

                case "Eliminar":
                    Conexion.EliminarCategoriaC(x.ID);
                    break;
                }
                return(View("FormCategoriaC", x));
            }
        }
        public ActionResult EdicionCategoriaC(string Accion, int ID = 0)
        {
            ViewBag.Enabled = new { };
            ViewBag.Accion  = Accion;
            if (Accion == "Insertar")
            {
                return(View("FormCategoriaC"));
            }

            if ((Accion == "Editar") || (Accion == "Eliminar") || (Accion == "Ver"))
            {
                if (Accion == "Ver")
                {
                    ViewBag.Enabled = new { disabled = "disabled" };
                    CategoriaCaracteristica x = Conexion.ObtenerCategoriaC(ID);
                    return(View("FormCategoriaC", x));
                }

                if (Accion == "Editar")
                {
                    CategoriaCaracteristica x = Conexion.ObtenerCategoriaC(ID);
                    return(View("FormCategoriaC", x));
                }

                if (Accion == "Eliminar")
                {
                    Conexion.EliminarCategoriaC(ID);
                }

                return(RedirectToAction("ABMCategoriaC"));
            }
            return(View("Index"));
        }