public IActionResult Index()
        {
            // Test GetById
            var book = _repository.GetByID(2);

            // Test GetMultiple
            var bookRecipes = _repository.GetMultiple(1);

            // Test Insert
            var bookToInsert = new Book
            {
                Name = "Dapper xUnit Tests 2"
            };

            _repository.Add(bookToInsert);

            // Test Update
            var bookToUpdate = _repository.GetByID(12);

            bookToUpdate.Name = "Last Update Data Access with Dapper 2";
            _repository.Update(bookToUpdate);

            // Test Delete
            var bookToDelete = _repository.GetByID(15);

            _repository.Delete(bookToDelete.Id);

            var books = _repository.GetAll();

            return(View(books));
        }
Esempio n. 2
0
        public IActionResult Index()
        {
            var books = _repository.GetAll().ToList();

            return(View(books));
        }