コード例 #1
0
        // GET: TipoAula/Edit/5
        public ActionResult Edit(int id)
        {
            var         taBLL = new TipoAulaBLL();
            tblTipoAula objTa = taBLL.RetrieveTipoAulaByID(id);

            return(View(objTa));
        }
コード例 #2
0
        public tblTipoAula RetrieveTipoAulaByID(int id)
        {
            tblTipoAula Result = null;

            using (var r = new Repository <tblTipoAula>())
            {
                Result = r.Retrieve(p => p.idTipoAula == id);
            }
            return(Result);
        }
コード例 #3
0
        public tblTipoAula RetrieveByTipoAulaTexto(string tipoAula)
        {
            tblTipoAula Result = null;

            using (var r = new Repository <tblTipoAula>())
            {
                Result = r.Retrieve(p => p.tipoAula == tipoAula);
            }
            return(Result);
        }
コード例 #4
0
        // GET: TipoAula/Delete/5
        public JsonResult DeleteTipoAula(int id)
        {
            var          taBLL   = new TipoAulaBLL();
            wmJsonResult objJson = new wmJsonResult();

            try
            {
                tblTipoAula tipoaula = taBLL.RetrieveTipoAulaByID(id);

                if (tipoaula != null)
                {
                    var            auBLL      = new AulaBLL();
                    List <tblAula> listaAulas = auBLL.RetrieveAulaTipoAulaByID(id);

                    if (listaAulas.Count() >= 0)
                    {
                        //significa que tiene Aulas....
                    }

                    bool banderita = taBLL.Delete(id);

                    if (banderita == true)
                    {
                        objJson.bandera = true;
                        objJson.mensaje = "El Tipo Aula se eliminó correctamente";
                    }
                    else
                    {
                        objJson.bandera = false;
                        objJson.mensaje = "El Tipo Aula NO se eliminó correctamente";
                    }
                }
                else
                {
                    objJson.bandera = false;
                    objJson.mensaje = "El Tipo Aula no se encontró";
                }
            }
            catch
            {
                objJson.bandera = false;
                objJson.mensaje = "Ocurrio una excepcion al eliminar el Tipo Aula";
            }

            return(Json(objJson, JsonRequestBehavior.AllowGet));
        }
コード例 #5
0
        public bool Delete(int id)
        {
            bool        Result = false;
            tblTipoAula obj    = RetrieveTipoAulaByID(id);

            if (obj != null)
            {
                using (var r = new Repository <tblTipoAula>())
                {
                    Result = r.Delete(obj);
                }
            }
            else
            {
                throw (new Exception("El tipo de aula seleccionado no se pudo eliminar."));
            }

            return(Result);
        }
コード例 #6
0
        public bool Update(tblTipoAula a)
        {
            bool Result = false;

            using (var r = new Repository <tblTipoAula>())
            {
                tblTipoAula ba = r.Retrieve(p => p.tipoAula == a.tipoAula && p.idTipoAula != a.idTipoAula);

                if (ba == null)
                {
                    Result = r.Update(a);
                }
                else
                {
                    throw (new Exception("No se pudo actualizar el tipo de aula"));
                }
            }
            return(Result);
        }
コード例 #7
0
        public tblTipoAula Create(tblTipoAula t)
        {
            tblTipoAula Result = null;

            using (var r = new Repository <tblTipoAula>())
            {
                tblTipoAula ba = r.Retrieve(p => p.tipoAula == t.tipoAula &&
                                            p.idTipoAula == t.idTipoAula);

                if (ba == null)
                {
                    Result = r.Create(t);
                }
                else
                {
                    throw (new Exception("El aula ya existe."));
                }
            }
            return(Result);
        }
コード例 #8
0
        public ActionResult Edit(tblTipoAula ta)
        {
            var          taBLL  = new TipoAulaBLL();
            ActionResult Result = null;

            try
            {
                if (ModelState.IsValid)
                {
                    taBLL.Update(ta);
                    Result = RedirectToAction("Index");
                }
            }
            catch
            {
                return(View());
            }

            return(Result);
        }