Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Email,Occupation")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Genre,Year,CountryofProduction")] Film film)
        {
            if (ModelState.IsValid)
            {
                _context.Add(film);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(film));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Id,ReviewText,FilmId,UserId,Rating")] Review review)
        {
            if (ModelState.IsValid)
            {
                _context.Add(review);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FilmId"] = new SelectList(_context.Films, "Id", "CountryofProduction", review.FilmId);
            ViewData["UserId"] = new SelectList(_context.Users, "Id", "Email", review.UserId);
            return(View(review));
        }