Exemplo n.º 1
0
        public Ca_Pais ObtenerPais(int id)
        {
            Ca_Pais pais = new Ca_Pais();

            try {
                if (id == 0)
                {
                    return(pais);
                }
                using (ClusmextContext context = new ClusmextContext()) {
                    pais = context.Ca_Pais.Where(x => x.Id_Pais == id).SingleOrDefault();
                }
            } catch (Exception ex) {
            }
            return(pais);
        }
Exemplo n.º 2
0
        public int Guardar(Ca_Pais pais)
        {
            int val = 0;

            try {
                using (ClusmextContext context = new ClusmextContext()) {
                    if (pais.Id_Pais > 0)
                    {
                        context.Entry(pais).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(pais).State = EntityState.Added;
                    }
                    val = context.SaveChanges();
                }
            } catch (Exception ex) {
            }
            return(val);
        }