Ejemplo n.º 1
0
        public CARGO traeCargo(int id)
        {
            CARGO cargo = new CARGO();

            try
            {
                using (var context = new SIGHUContext())
                {
                    cargo = (from c in context.CARGO
                             where c.IdCargo == id
                             select c).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(cargo);
        }
Ejemplo n.º 2
0
        public void activaCargo(int id)
        {
            CARGO cargo = new CARGO();

            try
            {
                using (var context = new SIGHUContext())
                {
                    cargo = (from c in context.CARGO
                             where c.IdCargo == id
                             select c).FirstOrDefault();

                    cargo.Activo = 1;

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }