public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Email,Occupation")] User user) { if (id != user.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(user)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ReviewText,FilmId,UserId,Rating")] Review review) { if (id != review.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(review); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReviewExists(review.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["FilmId"] = new SelectList(_context.Films, "Id", "CountryofProduction", review.FilmId); ViewData["UserId"] = new SelectList(_context.Users, "Id", "Email", review.UserId); return(View(review)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Genre,Year,CountryofProduction")] Film film) { if (id != film.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(film); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FilmExists(film.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(film)); }