コード例 #1
0
        //http://localhost:62098/FichaIngreso/Formulario?usuarioID=220 --> URL PARA USUARIOS EXTERNOS
        public ActionResult NuevoIngreso(int?id, int?usuarioID, bool interno = false)
        {
            ViewBag.TituloPanel = Etiquetas.TituloPanelFormularioFichaIngreso;
            ViewBag.UsuarioID   = usuarioID ?? 0;
            ViewBag.interno     = interno; // Para saber que Layout va a utilizar el usuario.
            try
            {
                FichaIngresoDetallada model = new FichaIngresoDetallada();
                model.FichaIngreso.FechaIngresoFicha = DateTime.Now;

                bool fichaIngresoExistente = FichaIngresoDAL.FichaIngresoExistente(usuarioID.Value);

                if (fichaIngresoExistente)
                {
                    return(RedirectToAction("Index"));
                }

                if (id.HasValue)
                {
                    model             = FichaIngresoDAL.ConsultarFichaIngresoDetallada(id.Value);
                    ViewBag.UsuarioID = model.FichaIngreso.UsuarioID;
                }
                return(View("Formulario", model));
            }
            catch (Exception ex)
            {
                return(View("Formulario", new FichaIngreso()));
            }
        }