Пример #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));
        }
Пример #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));
        }
Пример #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));
        }