Esempio n. 1
0
        public static bool Eliminar(Usuarios usuario)
        {
            bool interruptor = false;

            using (var conec = new UsuariosDb())
            {
                try
                {
                    conec.Entry(usuario).State = EntityState.Deleted;
                    conec.SaveChanges();
                    interruptor = true;
                }
                catch (Exception)
                {
                    throw;
                }
            }

            return(interruptor);
        }
Esempio n. 2
0
        public static bool Guardar(Usuarios usuarioNuevo)
        {
            bool interruptor = false;

            using (var conec = new UsuariosDb())
            {
                try
                {
                    conec.usuario.Add(usuarioNuevo);
                    conec.SaveChanges();
                    interruptor = true;
                }
                catch (Exception)
                {
                    throw;
                }
            }

            return(interruptor);
        }