/
Institucion.cs
50 lines (44 loc) · 1.49 KB
/
Institucion.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Logica
{
public class Institucion
{
public string NombreDeLaInstitucion { get; set; }
public string Identificador { get; set; }
public List<Sala> ListaDeSalas { get; set; }
public List<Padre> ListaDePadres { get; set; }
public Director DirectorDeLaInstitucion { get; set; }
public Sala BuscarSala(string numeroDeLaSala)
{
return ListaDeSalas.Find(x => x.NumeroDeLaSala == numeroDeLaSala);
}
public void EncontrarAlmuno(int numeroDeDocumento)
{
foreach (var item in ListaDeSalas)
{
item.BorrarAlmuno(numeroDeDocumento);
}
/*Otra Opcion
foreach (var item in ListaDeSalas)
{
item.ListaDeAlumnos.Exists(x => x.NumeroDeDocumento == numeroDeDocumento);
}*/
}
public void AgregarPadre(Padre padre, AlumnoHijo hijo)
{
if (ListaDePadres.Exists(x=> x.NumeroDeDocumento == padre.NumeroDeDocumento) == false)
{
padre.AgregarHijo(hijo);
ListaDePadres.Add(padre);
}
else
{
ListaDePadres.Find(x => x.NumeroDeDocumento == padre.NumeroDeDocumento).AgregarHijo(hijo);
}
}
}
}