Exemple #1
0
        public static Author CheckDuplicate(Author checkAuthor)
        {
            List <Author> allAuthors = Author.GetAll();
            bool          isInDB     = false;

            foreach (Author author in allAuthors)
            {
                if (author.GetFirstName() == checkAuthor.GetFirstName() && author.GetLastName() == checkAuthor.GetLastName())
                {
                    isInDB = true;
                    checkAuthor.SetId(author.GetId());
                }
            }

            if (!isInDB)
            {
                checkAuthor.Save();
            }
            return(checkAuthor);
        }