public ActionResult Editar(string id)
        {
            EducationalInstitutionBL oBL = new EducationalInstitutionBL();
            int pIntID = 0;

            int.TryParse(id, out pIntID);
            EducationalInstitutionViewModel pEducationalInstitutionViewModel = oBL.Obtener(pIntID);

            return(View(pEducationalInstitutionViewModel));
        }
        public JsonResult Verificar(int id_educational_institution, string name)
        {
            EducationalInstitutionBL oBL = new EducationalInstitutionBL();
            var resultado = oBL.VerificarDuplicado(id_educational_institution, name);

            return(Json(new
            {
                // this is what datatables wants sending back
                valido = resultado,
            }));
        }
        public JsonResult Eliminar(int id)
        {
            EducationalInstitutionBL oEducationalInstitutionBL = new EducationalInstitutionBL();

            oEducationalInstitutionBL.Eliminar(id);

            return(Json(new
            {
                // this is what datatables wants sending back
                status = "1",
            }));
        }
        public ActionResult Editar([Bind(Include = "educational_institution_id,name")] EducationalInstitutionViewModel pEducationalInstitutionViewModel)
        {
            // TODO: Add insert logic here

            if (pEducationalInstitutionViewModel == null)
            {
                return(HttpNotFound());
            }
            EducationalInstitutionBL oEducationalInstitutionBL = new EducationalInstitutionBL();

            pEducationalInstitutionViewModel.user_id_modified = AuthorizeUserAttribute.UsuarioLogeado().user_id;
            oEducationalInstitutionBL.Modificar(pEducationalInstitutionViewModel);
            return(RedirectToAction("Index"));
        }
        public JsonResult ObtenerLista(DataTableAjaxPostModel ofilters)//DataTableAjaxPostModel model
        {
            EducationalInstitutionBL oEducationalInstitutionBL = new EducationalInstitutionBL();
            //EducationalInstitutionFiltersViewModel ofilters = new EducationalInstitutionFiltersViewModel();
            GridModel <EducationalInstitutionViewModel> grid = oEducationalInstitutionBL.ObtenerLista(ofilters);

            return(Json(new
            {
                // this is what datatables wants sending back
                draw = ofilters.draw,
                recordsTotal = grid.total,
                recordsFiltered = grid.recordsFiltered,
                data = grid.rows
            }));
        }
        public ActionResult Crear([Bind(Include = "educational_institution_id,name")] EducationalInstitutionViewModel pEducationalInstitutionViewModel)
        {
            // TODO: Add insert logic here

            if (pEducationalInstitutionViewModel == null)
            {
                return(HttpNotFound());
            }
            pEducationalInstitutionViewModel.educational_institution_id = 0;
            pEducationalInstitutionViewModel.user_id_created            = AuthorizeUserAttribute.UsuarioLogeado().user_id;

            EducationalInstitutionBL oBL = new EducationalInstitutionBL();

            oBL.Agregar(pEducationalInstitutionViewModel);
            return(RedirectToAction("Index"));
        }