Esempio n. 1
0
        public int Delete(int idNorma)
        {
            try
            {
                using (var Conexion = new EntitiesPerfiles())
                {
                    TBL_NORMAS tblNormas = Conexion.TBL_NORMAS.Where(x => x.ID_NORMA == idNorma).FirstOrDefault();

                    Conexion.Entry(tblNormas).State = EntityState.Deleted;

                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception)
            {
                return(0);
            }
        }
Esempio n. 2
0
        public int Update(int idNorma, string especificacion, string descripcionCorta, string descripcionLarga)
        {
            try
            {
                using (var Conexion = new EntitiesPerfiles())
                {
                    TBL_NORMAS tblNormas = Conexion.TBL_NORMAS.Where(x => x.ID_NORMA == idNorma).FirstOrDefault();

                    tblNormas.ESPECIFICACION    = especificacion;
                    tblNormas.DESCRIPCION_CORTA = descripcionCorta;
                    tblNormas.DESCRIPCION_LARGA = descripcionLarga;

                    Conexion.Entry(tblNormas).State = EntityState.Modified;

                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception)
            {
                return(0);
            }
        }
Esempio n. 3
0
        public int Insert(string especificacion, string descripcionCorta, string descripcionLarga)
        {
            try
            {
                using (var Conexion = new EntitiesPerfiles())
                {
                    TBL_NORMAS tblNormas = new TBL_NORMAS();

                    tblNormas.ESPECIFICACION    = especificacion;
                    tblNormas.DESCRIPCION_CORTA = descripcionCorta;
                    tblNormas.DESCRIPCION_LARGA = descripcionLarga;

                    Conexion.TBL_NORMAS.Add(tblNormas);

                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception)
            {
                return(0);
            }
        }