Exemplo n.º 1
0
        public static bool Guardar(Clientes cliente)
        {
            bool retorno = false;

            try
            {
                using (var db = new BeautyBaseDB())
                {
                    if (Buscar(cliente.ClienteID) == null)
                    {
                        db.Cliente.Add(cliente);
                    }
                    else
                    {
                        db.Entry(cliente).State = EntityState.Modified;
                    }

                    db.SaveChanges();
                }
                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
Exemplo n.º 2
0
        public static bool Insertar(Empleados employes)
        {
            bool retorno = false;

            using (var Conn = new BeautyBaseDB())
            {
                try
                {
                    var e = Buscar(employes.EmpleadosID);
                    if (e == null)
                    {
                        Conn.Empleado.Add(employes);
                    }
                    else
                    {
                        Conn.Entry(employes).State = EntityState.Modified;
                    }
                    Conn.SaveChanges();
                    retorno = true;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(retorno);
        }
Exemplo n.º 3
0
        public static Clientes Buscar(int id)
        {
            Clientes client = new Clientes();

            using (BeautyBaseDB db = new BeautyBaseDB())
            {
                client = db.Cliente.Find(id);
            }
            return(client);
        }
Exemplo n.º 4
0
        public static List <Empleados> GetListaId(int EmpleadosId)
        {
            List <Empleados> list = new List <Empleados>();

            using (var db = new BeautyBaseDB())
            {
                try
                {
                    list = db.Empleado.Where(p => p.EmpleadosID == EmpleadosId).ToList();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(list);
        }
Exemplo n.º 5
0
        public static List <Empleados> GetLista()
        {
            var lista = new List <Empleados>();

            using (var conexion = new BeautyBaseDB())
            {
                try
                {
                    lista = conexion.Empleado.ToList();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(lista);
        }
Exemplo n.º 6
0
        public static Empleados Buscar(int Id)
        {
            var c = new Empleados();

            using (var Conn = new BeautyBaseDB())
            {
                try
                {
                    c = Conn.Empleado.Find(Id);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(c);
        }
Exemplo n.º 7
0
        public static bool Eliminar(Empleados employes)
        {
            bool resultado = false;

            using (var Conn = new BeautyBaseDB())
            {
                try
                {
                    Conn.Entry(employes).State = EntityState.Deleted;
                    Conn.SaveChanges();
                    resultado = true;
                    ///
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(resultado);
        }