示例#1
0
        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);
        }
示例#2
0
        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);
        }