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