public async Task <IActionResult> Edit(int id, [Bind("Id,HockeyMatchId,RefereeId,RefereeFeeId")] RefereeReceipt refereeReceipt) { if (id != refereeReceipt.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(refereeReceipt); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RefereeReceiptExists(refereeReceipt.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["HockeyMatchId"] = new SelectList(_context.Set <HockeyMatch>(), "Id", "Id", refereeReceipt.HockeyMatchId); ViewData["RefereeId"] = new SelectList(_context.Referee, "Id", "Id", refereeReceipt.RefereeId); ViewData["RefereeFeeId"] = new SelectList(_context.RefereeFee, "Id", "Id", refereeReceipt.RefereeFeeId); return(View(refereeReceipt)); }
public async Task <IActionResult> Create([Bind("Id,HockeyMatchId,RefereeId,RefereeFeeId")] RefereeReceipt refereeReceipt) { if (ModelState.IsValid) { _context.Add(refereeReceipt); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["HockeyMatchId"] = new SelectList(_context.Set <HockeyMatch>(), "Id", "Id", refereeReceipt.HockeyMatchId); ViewData["RefereeId"] = new SelectList(_context.Referee, "Id", "Id", refereeReceipt.RefereeId); ViewData["RefereeFeeId"] = new SelectList(_context.RefereeFee, "Id", "Id", refereeReceipt.RefereeFeeId); return(View(refereeReceipt)); }