Ejemplo n.º 1
0
        public bool Delete()
        {
            try
            {
                DALC.Bodega bodega = Common.ModeloEntidad.Bodega.First(f => f.Bodega_ID == this.Bodega_ID);

                Common.ModeloEntidad.Bodega.Remove(bodega);
                Common.ModeloEntidad.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        public bool Update()
        {
            try
            {
                DALC.Bodega bodega = Common.ModeloEntidad.Bodega.First(f => f.Bodega_ID == this.Bodega_ID);
                bodega.Nombre       = this.Nombre;
                bodega.Ubicacion_ID = this.Ubicacion_ID;

                Common.ModeloEntidad.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        public bool Read()
        {
            try
            {
                DALC.Bodega bodega = Common.ModeloEntidad.Bodega.First(f => f.Bodega_ID == this.Bodega_ID);

                this.Bodega_ID    = bodega.Bodega_ID;
                this.Nombre       = bodega.Nombre;
                this.Ubicacion_ID = bodega.Ubicacion_ID;

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        public bool Create()
        {
            try
            {
                DALC.Bodega bodega = new DALC.Bodega();
                bodega.Nombre       = this.Nombre;
                bodega.Bodega_ID    = this.Bodega_ID;
                bodega.Ubicacion_ID = this.Ubicacion_ID;

                Common.ModeloEntidad.Bodega.Add(bodega);
                Common.ModeloEntidad.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                string test = ex.ToString();
                Common.ModeloEntidad.Bodega.Local.Clear();
                return(false);
            }
        }