Example #1
0
        public ActionResult EdicionCatPers(int Id, string Accion)
        {
            int v = ValidarUsuario();

            if (v == 1)
            {
                return(View("../Home/Login"));
            }
            if (v == 2)
            {
                return(View("../Home/Index"));
            }
            ViewBag.Accion = Accion;
            if (Accion == "Insertar")
            {
                return(View("FormCatPers"));
            }
            else
            {
                CategoríaP C = BD.GetCategoria(Id);
                if (Accion == "Eliminar")
                {
                    return(View("ConfirmarEliminarCategoria", C));
                }
                else
                {
                    return(View("FormCatPers", C));
                }
            }
        }
Example #2
0
        public ActionResult OperacionesCatPers(CategoríaP C, string Accion)
        {
            int v = ValidarUsuario();

            if (v == 1)
            {
                return(View("../Home/Login"));
            }
            if (v == 2)
            {
                return(View("../Home/Index"));
            }
            if (!ModelState.IsValid)
            {
                return(View("FormCatPers", C));
            }
            else
            {
                ViewBag.View = "ABMCatPersonajes";
                if (Accion == "Insertar")
                {
                    bool val = BD.InsertarCategoría(C.Nombre);

                    if (val != false)
                    {
                        return(View("ExitoOp"));
                    }
                    else
                    {
                        return(View("ErrorOp"));
                    }
                }
                if (Accion == "Ver")
                {
                    ViewBag.ListaCatPers = BD.ListarCategoriasPersonajes();
                    return(View("ABMCatPersonajes"));
                }
                if (Accion == "Modificar")
                {
                    bool M = BD.UpdateCategoría(C.Id, C.Nombre);
                    if (M == true)
                    {
                        return(View("ExitoOp"));
                    }
                    else
                    {
                        return(View("ErrorOp"));
                    }
                }
                if (Accion == "Eliminar")
                {
                    bool E = BD.DeleteCategoría(C.Id);
                    if (E == true)
                    {
                        return(View("ExitoOp"));
                    }
                    else
                    {
                        return(View("ErrorOp"));
                    }
                }
            }

            return(View("ErrorOp"));
        }