コード例 #1
0
        public static bool AddAuthor(string FirstName, string LastName, string DateOfBirth)
        {
            var Author = new AuthorModel(FirstName, LastName, DateOfBirth);

            if (!Authors.Contains(Author))
            {
                Authors.Add(Author);
                Console.WriteLine("{0} {1} has been already added to the system", Author.FirstName, Author.LastName);
                return(true);
            }
            else
            {
                Console.WriteLine("This Author has been already launched!");
                return(false);
            }
        }
コード例 #2
0
        public static AuthorModel FindAuthor(string lastnameList)
        {
            AuthorModel item    = null;
            var         itemTmp = Authors.Find(
                x => x.LastName.ToLower().Contains(lastnameList.ToString().ToLower()));

            if (item == null)
            {
                item = itemTmp;
            }
            else
            {
                return(null);
            }
            return(item);
        }
コード例 #3
0
 public void LoadData()
 {
     author = new AuthorModel("Joanne", "Rowling", "02-03-1900");
 }