Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("CustomerId,CustomerName,CustomerPhoneNumber")] CustomerModel customerModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customerModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customerModel));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("MovieId,MovieName,MovieDescription,GenreId")] MovieModel movieModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(movieModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GenreId"] = new SelectList(_context.Genres, "GenreId", "GenreId", movieModel.GenreId);
            return(View(movieModel));
        }