コード例 #1
0
        public ActionResult Index(string author)
        {
            // Author newAuthor = new Author(author);
            // newAuthor.Save();
            List <Author> allAuthors = Author.GetAll();

            return(View(allAuthors));
        }
コード例 #2
0
ファイル: Authors.cs プロジェクト: grepcats/library-catalog
        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);
        }