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));
        }
Exemple #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));
        }
Exemple #3
0
 public void Add(Video newVideo)
 {
     _db.Add(newVideo);
     Commit();
 }