public static bool IsPersonNotEmpty(Person person) { if (person.FirstName != null && person.LastName != null && person.Age != 0 && person.Pesel != null && person.PhoneNumber != null) { return true; } return false; }
public void AddPerson(Person person) { List<Person> persons = GetAllPersons(); if (File.Exists(path)) { persons.Add(person); XMLSerializer.Serialization(persons, path); } else { persons.Add(person); XMLSerializer.Serialization(persons, path); } }
private Person ConsoleRead() { Person personView = new Person(); Console.WriteLine("Podaj imię: "); personView.FirstName = Console.ReadLine(); Console.WriteLine("Podaj nazwisko: "); personView.LastName = Console.ReadLine(); Console.WriteLine("Podaj wiek: "); personView.Age = int.Parse(Console.ReadLine()); Console.WriteLine("Podaj pesel: "); personView.Pesel = Console.ReadLine(); Console.WriteLine("Podaj nr telefonu: "); personView.PhoneNumber = Console.ReadLine(); return personView; }