Ejemplo n.º 1
0
        public bool guardarDB(tb_region_Info info)
        {
            try
            {
                using (Entities_general Context = new Entities_general())
                {
                    tb_region Entity = new tb_region
                    {
                        Cod_Region = info.Cod_Region = get_id(),
                        Nom_region = info.Nom_region,
                        codigo     = info.codigo,
                        estado     = info.estado = true,
                        IdPais     = info.IdPais
                    };
                    Context.tb_region.Add(Entity);
                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        public tb_region_Info get_info(string CodRegion)
        {
            try
            {
                tb_region_Info info = new tb_region_Info();

                using (Entities_general Context = new Entities_general())
                {
                    tb_region Entity = Context.tb_region.FirstOrDefault(q => q.Cod_Region == CodRegion);
                    if (Entity == null)
                    {
                        return(null);
                    }

                    info = new tb_region_Info
                    {
                        Cod_Region = Entity.Cod_Region,
                        codigo     = Entity.codigo,
                        Nom_region = Entity.Nom_region,
                        estado     = Entity.estado,
                        IdPais     = Entity.IdPais
                    };
                }

                return(info);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 3
0
        public bool anularDB(tb_region_Info info)
        {
            try
            {
                using (Entities_general Context = new Entities_general())
                {
                    tb_region Entity = Context.tb_region.FirstOrDefault(q => q.Cod_Region == info.Cod_Region);
                    if (Entity == null)
                    {
                        return(false);
                    }
                    Entity.estado = info.estado = false;
                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }