public async Task <IActionResult> Create([Bind("GenreId,Name")] Genre genre)
        {
            if (ModelState.IsValid)
            {
                await _genreService.AddAndSave(genre);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(genre));
        }
Ejemplo n.º 2
0
        public async Task AddTest()
        {
            var fakeRepository = Mock.Of <IGenresRepository>();
            var genreService   = new GenreService(fakeRepository);

            var genre = new Genre()
            {
                Genre_name = "test genre"
            };
            await genreService.AddAndSave(genre);
        }
Ejemplo n.º 3
0
        public async Task NullNameAddTest()
        {
            var    fakeRepository = Mock.Of <IGenresRepository>();
            var    genreService   = new GenreService(fakeRepository);
            String name           = "";

            Assert.NotNull(name);
            var group = new Genre()
            {
                Genre_name = name
            };
            await genreService.AddAndSave(group);
        }