public async Task <IActionResult> Edit(int id, [Bind("MovieId,LanguageId")] MovieLanguages movieLanguages) { if (id != movieLanguages.MovieId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(movieLanguages); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MovieLanguagesExists(movieLanguages.MovieId)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["LanguageId"] = new SelectList(_context.Language, "Id", "Id", movieLanguages.LanguageId); ViewData["MovieId"] = new SelectList(_context.Movie, "Id", "Id", movieLanguages.MovieId); return(View(movieLanguages)); }
public async Task <IActionResult> Create([Bind("MovieId,LanguageId")] MovieLanguages movieLanguages) { if (ModelState.IsValid) { _context.Add(movieLanguages); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["LanguageId"] = new SelectList(_context.Language, "Id", "Id", movieLanguages.LanguageId); ViewData["MovieId"] = new SelectList(_context.Movie, "Id", "Id", movieLanguages.MovieId); return(View(movieLanguages)); }