Exemple #1
0
 public override bool Equals(System.Object otherAuthor)
 {
     if (!(otherAuthor is Author))
     {
         return(false);
     }
     else
     {
         Author newAuthor               = (Author)otherAuthor;
         bool   authorIdEquality        = (this.GetId() == newAuthor.GetId());
         bool   authorFirstNameEquality = (this.GetFirstName() == newAuthor.GetFirstName());
         bool   authorLastNameEquality  = (this.GetLastName() == newAuthor.GetLastName());
         return(authorIdEquality && authorFirstNameEquality && authorLastNameEquality);
     }
 }
Exemple #2
0
 public override bool Equals(System.Object otherAuthor)
 {
     if (!(otherAuthor is Author))
     {
         return(false);
     }
     else
     {
         Author newAuthor         = (Author)otherAuthor;
         bool   idEquality        = (this.GetId() == newAuthor.GetId());
         bool   firstNameEquality = (this.GetFirstName() == newAuthor.GetFirstName());
         bool   lastNameEquality  = (this.GetLastName() == newAuthor.GetLastName());
         // return _id == newBook._id && _title == newBook._title && _callNumber == newBook._callNumber && _tagNumber == newBook._tagNumber && _checkoutDate == newBook._checkoutDate && _dueDate == newBook._dueDate && _status == newBook._status;
         return(idEquality && firstNameEquality && lastNameEquality);
     }
 }
Exemple #3
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);
        }