Example #1
0
        public bool Delete()
        {
            try
            {
                DALC.Ubicacion ubicacion = Common.ModeloEntidad.Ubicacion.First(f => f.Ubicacion_ID == this.Ubicacion_ID);

                Common.ModeloEntidad.Ubicacion.Remove(ubicacion);
                Common.ModeloEntidad.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Example #2
0
        public bool Read()
        {
            try
            {
                DALC.Ubicacion ubicacion = Common.ModeloEntidad.Ubicacion.First(f => f.Ubicacion_ID == this.Ubicacion_ID);

                this.Ubicacion_ID = ubicacion.Ubicacion_ID;
                this.Nombre       = ubicacion.Nombre;
                this.Direccion    = ubicacion.Direccion;
                this.TorreBlock   = ubicacion.TorreBlock;
                this.NroDpto      = Convert.ToInt32(ubicacion.NroDpto);
                this.Numero       = ubicacion.Numero;
                this.Comuna_ID    = ubicacion.Comuna_ID;
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Example #3
0
        public bool Update()
        {
            try
            {
                DALC.Ubicacion ubicacion = Common.ModeloEntidad.Ubicacion.First(f => f.Ubicacion_ID == this.Ubicacion_ID);

                ubicacion.Ubicacion_ID = this.Ubicacion_ID;
                ubicacion.Nombre       = this.Nombre;
                ubicacion.Direccion    = this.Direccion;
                ubicacion.TorreBlock   = this.TorreBlock;
                ubicacion.NroDpto      = this.NroDpto;
                ubicacion.Numero       = this.Numero;
                ubicacion.Comuna_ID    = this.Comuna_ID;

                Common.ModeloEntidad.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Example #4
0
        public bool Create()
        {
            try
            {
                DALC.Ubicacion newUbicacion = new DALC.Ubicacion();
                newUbicacion.Ubicacion_ID = this.Ubicacion_ID;
                newUbicacion.Nombre       = this.Nombre;
                newUbicacion.Direccion    = this.Direccion;
                newUbicacion.TorreBlock   = this.TorreBlock;
                newUbicacion.NroDpto      = this.NroDpto;
                newUbicacion.Numero       = this.Numero;
                newUbicacion.Comuna_ID    = this.Comuna_ID;

                Common.ModeloEntidad.Ubicacion.Add(newUbicacion);
                Common.ModeloEntidad.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }