Ejemplo n.º 1
0
        public bool Read()
        {
            try
            {
                DALC.Categoria categoria = Common.ModeloEntidad.Categoria.First(f => f.Categoria_ID == this.Categoria_ID);
                this.Nombre = categoria.Nombre;

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        public bool Delete()
        {
            try
            {
                DALC.Categoria categoria = Common.ModeloEntidad.Categoria.First(f => f.Categoria_ID == this.Categoria_ID);

                Common.ModeloEntidad.Categoria.Remove(categoria);
                Common.ModeloEntidad.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        public bool Update()
        {
            try
            {
                DALC.Categoria categoria = Common.ModeloEntidad.Categoria.First(f => f.Categoria_ID == this.Categoria_ID);
                categoria.Nombre = this.Nombre;

                Common.ModeloEntidad.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        public bool Create()
        {
            try
            {
                DALC.Categoria categoria = new DALC.Categoria();
                categoria.Categoria_ID = this.Categoria_ID;
                categoria.Nombre       = this.Nombre;

                Common.ModeloEntidad.Categoria.Add(categoria);
                Common.ModeloEntidad.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                Common.ModeloEntidad.Categoria.Local.Clear();
                return(false);
            }
        }