public async Task <IActionResult> Edit(Guid id, [Bind("ID,CamperID,MealID,GameID,Grade")] Enrollment enrollment) { if (id != enrollment.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(enrollment); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EnrollmentExists(enrollment.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CamperID"] = new SelectList(_context.Campers, "ID", "FirstMidName", enrollment.CamperID); ViewData["GameID"] = new SelectList(_context.Games, "ID", "ID", enrollment.GameID); ViewData["MealID"] = new SelectList(_context.Meals, "ID", "ID", enrollment.MealID); return(View(enrollment)); }
public async Task <IActionResult> Edit(Guid id, [Bind("ID,Gym,RecRoom,Computer")] 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))); } return(View(game)); }
public async Task <IActionResult> Edit(Guid id, [Bind("ID,LastName,FirstMidName,Email,Phone,EnrollmentDate")] Camper camper) { if (id != camper.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(camper); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CamperExists(camper.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(camper)); }