Beispiel #1
0
        public ResponseDTO Remove(int id)
        {
            ResponseDTO    objresponse = new ResponseDTO();
            ColegioContext objCnn      = new ColegioContext();

            try
            {
                Trasversales.Modelo.Cursos obj = objCnn.cursos.Find(id);

                objCnn.Entry(obj).State = EntityState.Deleted;

                objCnn.SaveChanges();

                objresponse.codigo    = 1;
                objresponse.respuesta = "";
            }
            catch (Exception e)
            {
                objresponse.codigo    = -1;
                objresponse.respuesta = e.Message;
            }
            return(objresponse);
        }
Beispiel #2
0
        public ResponseCursoCustom Update(Trasversales.Modelo.Cursos modelo)
        {
            ResponseCursoCustom objresponse = new ResponseCursoCustom();
            ColegioContext      objCnn      = new ColegioContext();

            try
            {
                objCnn.Entry(modelo).State = EntityState.Modified;

                objCnn.SaveChanges();

                objresponse.resultado.codigo    = 1;
                objresponse.resultado.respuesta = "";

                objresponse.curso = this.Get(modelo.CurId).FirstOrDefault();
            }
            catch (Exception e)
            {
                objresponse.resultado.codigo    = -1;
                objresponse.resultado.respuesta = e.Message;
            }
            return(objresponse);
        }
Beispiel #3
0
        public CursosCustom Save(Trasversales.Modelo.Cursos modelo)
        {
            //  ResponseDTO objresponse = new ResponseDTO();
            ColegioContext objCnn      = new ColegioContext();
            CursosCustom   objInserted = new CursosCustom();

            try
            {
                objCnn.cursos.Add(modelo);

                objCnn.SaveChanges();

                objInserted = this.Get(modelo.CurId).FirstOrDefault();

                //objresponse.codigo = 1;
                //objresponse.respuesta = "";
            }
            catch (Exception e)
            {
                //objresponse.codigo = -1;
                //objresponse.respuesta = e.Message;
            }
            return(objInserted);
        }