Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("MovieID,Category,Title,Year,Director,Rating,LentTo,Edited,Notes")] Movie movie)
        {
            if (ModelState.IsValid)
            {
                _context.Add(movie);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(ViewMovies))); //after submitting redirects you back to the movie list
            }
            return(View(movie));                              //the movie object is added to the database
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("Id,Title,ReleaseDate,Genre,Rating")] Movie movie)
        {
            if (ModelState.IsValid)
            {
                _context.Add(movie);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(movie));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("MovieId,Category,Title,Year,Director,Rating,LentTo,Edited,Notes")] Movie movie)
        {
            if (ModelState.IsValid)
            {
                _context.Add(movie);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(MovieList)));
            }
            return(View(movie));
        }