public async Task <IActionResult> Edit(int id, [Bind("ActorId,FirstName,LastName,LastUpdate")] Actor actor) { if (id != actor.ActorId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(actor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ActorExists(actor.ActorId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(actor)); }
public async Task <IActionResult> Edit(int id, [Bind("CustomerId,StoreId,FirstName,LastName,Email,AddressId,Active,CreateDate,LastUpdate")] Customer customer) { if (id != customer.CustomerId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.CustomerId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AddressId"] = new SelectList(_context.Address, "AddressId", "Address1", customer.AddressId); ViewData["StoreId"] = new SelectList(_context.Store, "StoreId", "StoreId", customer.StoreId); return(View(customer)); }
public async Task <IActionResult> Edit(short id, [Bind("CountryId,Country1,LastUpdate")] Country country) { if (id != country.CountryId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(country); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CountryExists(country.CountryId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(country)); }
public async Task <IActionResult> Edit(int id, [Bind("FilmId,Title,Description,ReleaseYear,LanguageId,OriginalLanguageId,RentalDuration,RentalRate,Length,ReplacementCost,Rating,SpecialFeatures,LastUpdate")] Film film) { if (id != film.FilmId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(film); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FilmExists(film.FilmId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["LanguageId"] = new SelectList(_context.Language, "LanguageId", "Name", film.LanguageId); ViewData["OriginalLanguageId"] = new SelectList(_context.Language, "LanguageId", "Name", film.OriginalLanguageId); return(View(film)); }
public async Task <IActionResult> Edit(int id, [Bind("AddressId,Address1,Address2,District,CityId,PostalCode,Phone,LastUpdate")] Address address) { if (id != address.AddressId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(address); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AddressExists(address.AddressId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CityId"] = new SelectList(_context.City, "CityId", "City1", address.CityId); return(View(address)); }
public async Task <IActionResult> Edit(ushort id, [Bind("ActorId,FilmId,LastUpdate")] FilmActor filmActor) { if (id != filmActor.ActorId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(filmActor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FilmActorExists(filmActor.ActorId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ActorId"] = new SelectList(_context.Actor, "ActorId", "FirstName", filmActor.ActorId); ViewData["FilmId"] = new SelectList(_context.Film, "FilmId", "Title", filmActor.FilmId); return(View(filmActor)); }
public async Task <IActionResult> Edit(byte id, [Bind("StaffId,FirstName,LastName,AddressId,Picture,Email,StoreId,Active,Username,Password,LastUpdate")] Staff staff) { if (id != staff.StaffId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(staff); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StaffExists(staff.StaffId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AddressId"] = new SelectList(_context.Address, "AddressId", "Address1", staff.AddressId); ViewData["StoreId"] = new SelectList(_context.Store, "StoreId", "StoreId", staff.StoreId); return(View(staff)); }
public async Task <IActionResult> Edit(int id, [Bind("CityId,City1,CountryId,LastUpdate")] City city) { if (id != city.CityId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(city); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CityExists(city.CityId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CountryId"] = new SelectList(_context.Country, "CountryId", "Country1", city.CountryId); return(View(city)); }
public async Task <IActionResult> Edit(int id, [Bind("PaymentId,CustomerId,StaffId,RentalId,Amount,PaymentDate,LastUpdate")] Payment payment) { if (id != payment.PaymentId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(payment); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PaymentExists(payment.PaymentId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customer, "CustomerId", "Active", payment.CustomerId); ViewData["RentalId"] = new SelectList(_context.Rental, "RentalId", "RentalId", payment.RentalId); ViewData["StaffId"] = new SelectList(_context.Staff, "StaffId", "FirstName", payment.StaffId); return(View(payment)); }