Exemple #1
0
        public ActionResult Crear(Inscripcion modelo, bool activo)
        {
            if (ModelState.IsValid)
            {
                modelo.ColegioId     = CustomHelper.getColegioId();
                modelo.ResponsableId = CustomHelper.getUsuarioId();
                modelo.Activo        = activo;

                string strMensaje = new InscripcionBL().Guardar(modelo);

                if (strMensaje.Equals("OK"))
                {
                    TempData["Inscripcion-Success"] = strMensaje;
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", strMensaje);
                }
            }

            string strAtributo = "checked='checked'";

            ViewBag.ActivoSi = activo == true ? strAtributo : "";
            ViewBag.ActivoNo = activo == false ? strAtributo : "";

            this.CargaControles();
            return(View(modelo));
        }
Exemple #2
0
        public ActionResult Index(int?page, string search)
        {
            CustomHelper.setTitulo("Inscripción", "Listado");

            List <Inscripcion> Inscripciones = new List <Inscripcion>();

            try
            {
                if (!string.IsNullOrWhiteSpace(search) && search != null)
                {
                    Inscripciones = new InscripcionBL().Buscar(search, CustomHelper.getColegioId()).ToList();
                }
                else
                {
                    Inscripciones = new InscripcionBL().ObtenerListado(CustomHelper.getColegioId());
                }
            }
            catch (Exception ex)
            {
                ViewBag.Error = string.Format("Message: {0} StackTrace: {1}", ex.Message, ex.StackTrace);
                return(View("~/Views/Shared/Error.cshtml"));
            }

            ViewBag.Search = search;

            int pageSize   = 15;
            int pageNumber = (page ?? 1);

            return(View(Inscripciones.ToPagedList(pageNumber, pageSize)));
        }
Exemple #3
0
        public ActionResult Eliminar(long id)
        {
            Inscripcion InscripcionActual = new InscripcionBL().ObtenerxId(id, true);

            if (InscripcionActual == null || InscripcionActual.InscripcionId == 0)
            {
                return(HttpNotFound());
            }

            CustomHelper.setTitulo("Inscripción", "Editar");

            return(View(InscripcionActual));
        }
Exemple #4
0
        public ActionResult Eliminar(Inscripcion modelo)
        {
            string strMensaje = new InscripcionBL().Eliminar(modelo);

            if (strMensaje.Equals("OK"))
            {
                TempData["Inscripcion_Eliminar-Success"] = strMensaje;
                return(RedirectToAction("Index"));
            }
            else
            {
                ModelState.AddModelError("", strMensaje);
            }

            return(View(new InscripcionBL().ObtenerxId(modelo.InscripcionId, true)));
        }