Beispiel #1
0
        public async Task <IActionResult> Create([Bind("Id,RatingValue")] Rating rating)
        {
            if (ModelState.IsValid)
            {
                _context.Add(rating);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(rating));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,UserName")] Writer writer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(writer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(writer));
        }
Beispiel #3
0
        public async Task <IActionResult> Create([Bind("Id,Title,ReleaseDate,Country,Description,Genre,RatingId")] Movie movie)
        {
            if (ModelState.IsValid)
            {
                _context.Add(movie);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RatingId"] = new SelectList(_context.Rating, "Id", "RatingValue", movie.RatingId);
            return(View(movie));
        }