public async Task <IActionResult> Edit(int id, [Bind("Id,Name,ReleaseDate,Director,Email,Language,Category")] MovieTble movieTble) { if (id != movieTble.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(movieTble); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MovieTbleExists(movieTble.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Category"] = new SelectList(_context.CategoryTble, "Code", "Code", movieTble.Category); return(View(movieTble)); }
public async Task <IActionResult> Create([Bind("Id,Name,ReleaseDate,Director,Email,Language,Category")] MovieTble movieTble) { if (ModelState.IsValid) { _context.Add(movieTble); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["Category"] = new SelectList(_context.CategoryTble, "Code", "Code", movieTble.Category); return(View(movieTble)); }