public async Task <IActionResult> Edit(int id, [Bind("Id,FactoryName,CountryId")] Factory factory) { if (id != factory.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(factory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FactoryExists(factory.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CountryId"] = new SelectList(_context.Country, "Id", "CountryName", factory.CountryId); return(View(factory)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,PlayerId,RacketId")] PlayerRackets playerRackets) { if (id != playerRackets.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(playerRackets); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlayerRacketsExists(playerRackets.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Id"] = new SelectList(_context.Racket, "Id", "Id", playerRackets.Id); ViewData["PlayerId"] = new SelectList(_context.Player, "Id", "Name", playerRackets.PlayerId); return(View(playerRackets)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,CountryName")] Country country) { if (id != country.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(country); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CountryExists(country.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(country)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Player1Id,Player2Id,Racket1Id,Racket2Id,Result,Score,GameDate")] Game game) { if (id != game.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(game); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GameExists(game.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Player1Id"] = new SelectList(_context.Player, "Id", "Name", game.Player1Id); ViewData["Player2Id"] = new SelectList(_context.Player, "Id", "Name", game.Player2Id); ViewData["Racket1Id"] = new SelectList(_context.PlayerRackets, "Id", "Id", game.Racket1Id); ViewData["Racket2Id"] = new SelectList(_context.PlayerRackets, "Id", "Id", game.Racket2Id); return(View(game)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FactoryId,BladeName,Composite")] Blade blade) { if (id != blade.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(blade); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BladeExists(blade.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["FactoryId"] = new SelectList(_context.Factory, "Id", "FactoryName", blade.FactoryId); return(View(blade)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FactoryId,RubberName,Pimples")] Rubber rubber) { if (id != rubber.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(rubber); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RubberExists(rubber.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["FactoryId"] = new SelectList(_context.Factory, "Id", "FactoryName", rubber.FactoryId); return(View(rubber)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,BladeId,FhrubberId,BhrubberId")] Racket racket) { if (id != racket.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(racket); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RacketExists(racket.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BhrubberId"] = new SelectList(_context.Rubber, "Id", "RubberName", racket.BhrubberId); ViewData["BladeId"] = new SelectList(_context.Blade, "Id", "BladeName", racket.BladeId); ViewData["FhrubberId"] = new SelectList(_context.Rubber, "Id", "RubberName", racket.FhrubberId); return(View(racket)); }