Example #1
0
        public bool InsertAlumno(string rut)
        {
            try
            {
                Alumnos alum = (from al in AlumnosExterno
                                where al.Rut == rut
                                select new Alumnos
                {
                    Nombre = al.Nombre,
                    Apellido = al.Apellido,
                    Correo = al.Correo,
                    Edad = al.Edad,
                    IdEvento = 1,
                    Jornada = al.Jornada,
                    Rut = al.Rut,
                    Telefono = al.Telefono
                }).First();
                if (alum != null && !Alumnos.Exists(a => alum.Rut == a.Rut))
                {
                    Alumnos.Add(alum);
                }
                else
                {
                    throw new Exception();
                }
                return(true);
            }
            catch (Exception)
            {
                return(false);

                throw;
            }
        }
Example #2
0
        public bool UpdateAlumno(Alumnos alumno)
        {
            try
            {
                foreach (Alumnos a in Alumnos)
                {
                    if (a.Rut == alumno.Rut)
                    {
                        a.Nombre   = alumno.Nombre;
                        a.Jornada  = alumno.Jornada;
                        a.Telefono = alumno.Telefono;
                        a.Edad     = alumno.Edad;
                        a.Correo   = alumno.Correo;
                        a.Apellido = alumno.Apellido;
                        return(true);
                    }
                }
                throw new Exception();
            }
            catch (Exception)
            {
                return(false);

                throw;
            }
        }