示例#1
0
 public ActionResult AddAuthor(Author item)
 {
     if (arep.Any(x => x.Name == item.Name && x.LastName == item.LastName))
     {
         return(RedirectToAction("ListAuthors"));
     }
     else
     {
         arep.Add(item);
         return(RedirectToAction("ListAuthors"));
     }
 }
        public void Should_Find_An_Entity()
        {
            var repository = new AuthorRepository();
            repository.Insert(new Author()
            {
                FirstName = "Bruce",
                LastName = "Wayne"
            });

            repository.Insert(new Author()
            {
                FirstName = "Dick",
                LastName = "Grayson"
            });

            Assert.IsTrue(repository.Any(author => author.FirstName == "Dick" && author.LastName == "Grayson"));
        }