public IPerson FindByUsername(string username) { if (username == null) { throw new ArgumentException(); } var newPerson = PersonList.FirstOrDefault(p => p.Username == username); if (newPerson == null) { throw new InvalidOperationException(); } return(newPerson); }
public IPerson FindById(int id) { if (id < 0) { throw new ArgumentOutOfRangeException(); } var newPerson = PersonList.FirstOrDefault(p => p.Id == id); if (newPerson == null) { throw new InvalidOperationException(); } return(newPerson); }