public async Task <IActionResult> Create([Bind("Id,Name,Author,ISBN")] Book book)
        {
            if (ModelState.IsValid)
            {
                await _context.AddAsync(book);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(book));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("ID,Title,ReleaseDate,Genre,Price,Rating")]
                                                 Movie movie)
        {
            if (ModelState.IsValid)
            {
                await _context.AddAsync(movie);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            return(View(movie));
        }