Beispiel #1
0
        //Metodo para mostrar detalles

        #region details()

        //Mantenimiento
        //Editar
        //GET:

        public ActionResult Details(int?id)
        {
            Employees oEmployee = new Employees();

            try
            {
                modelEmpleadoEF omEmpleados = new modelEmpleadoEF();
                oEmployee       = omEmpleados.consEmpleadoPorId(id);
                ViewBag.OK      = true;
                ViewBag.DATOS   = omEmpleados;
                ViewBag.MENSAJE = "Patata Success";
                ViewBag.MODIF   = false;

                return(View("listaFiltro"));
            }

            catch (Exception e)
            {
                ViewBag.MODIF   = false;
                ViewBag.OK      = false;
                ViewBag.MENSAJE = "Patata con ERROR: " + e.Message;

                return(View("paginaError"));
            }
        }
Beispiel #2
0
        public ActionResult Delete(int ID)
        {
            try
            {
                Employees       oEmployee  = new Employees();
                modelEmpleadoEF omEmpleado = new modelEmpleadoEF();
                oEmployee = omEmpleado.consEmpleadoPorId(ID);
                int resultado = omEmpleado.delete(oEmployee);

                if (resultado == 1)
                {
                    ViewBag.OK      = true;
                    ViewBag.DATOS   = oEmployee;
                    ViewBag.MENSAJE = "Se ha borrado el registro.";
                    ViewBag.MODIF   = true;
                }
                else
                {
                    ViewBag.MODIF   = false;
                    ViewBag.OK      = false;
                    ViewBag.MENSAJE = "No se pudo borrar el registro";
                }
            }
            catch (Exception e)
            {
                ViewBag.MODIF   = false;
                ViewBag.OK      = false;
                ViewBag.MENSAJE = "Patata con ERROR: " + e.Message;

                return(View("paginaError"));
            }


            return(RedirectToAction("listaFiltro"));
        }