public void GetListStudents() { var repo = Students.DepCon.Resolve <IRepository <Students> >(); StudentsList = repo.QueryAll().ToList(); if (DniVM == "") { DniVM = null; } if (LNameVM == "") { LNameVM = null; } if (DniVM != null || LNameVM != null) { if (DniVM != null) { StudentsList = StudentsList.FindAll(x => x.Dni == DniVM); } else { StudentsList = StudentsList.FindAll(x => x.LastName.Contains(LNameVM)); } if (StudentsList.Count == 0) { messageBoxText = "No se ha encontrado el alumno"; MessageBox.Show(messageBoxText, caption, button, icon); DniVM = null; LNameVM = null; } else if (StudentsList.Count == 1) { CurrentStudent = StudentsList[0]; DniVM = StudentsList[0].Dni; LNameVM = StudentsList[0].LastName; } } }
public void GetStudents() { var repo = Students.DepCon.Resolve <IRepository <Students> >(); StudentsList = repo.QueryAll().ToList(); if (DniVM == "") { DniVM = null; } if (LNameVM == "") { LNameVM = null; } if ((DniVM != null || LNameVM != null) && isEdit == false) { if (DniVM != null) { StudentsList = StudentsList.FindAll(x => x.Dni == DniVM); } else if (LNameVM != null) { StudentsList = StudentsList.FindAll(x => x.LastName.Contains(LNameVM)); } } if (StudentsList.Count == 1) { CurrentStudent = StudentsList[0]; DniVM = CurrentStudent.Dni; FNameVM = CurrentStudent.FirstName; LNameVM = CurrentStudent.LastName; EmailVM = CurrentStudent.Email; } }