public async Task <IActionResult> Edit(int id, [Bind("LeagueID,LeagueName")] League league) { if (id != league.LeagueID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(league); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LeagueExists(league.LeagueID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(league)); }
// TODO: 3b) Make sure that this is binding to the 'Position' property public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Number")] Player player) { if (id != player.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(player); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlayerExists(player.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(player)); }
public async Task <IActionResult> Edit(int id, [Bind("SubmitBackGroundCheck,Position,YearsExperience,ID,LastName,FirstName,MiddleName,Birthday," + "PhoneNumber,Street,City,State,Zipcode")] Volunteer volunteer) { if (id != volunteer.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(volunteer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VolunteerExists(volunteer.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(volunteer)); }
public async Task <IActionResult> Edit(int id, [Bind("YearsExperience,ElementarySchool,GuardianName,ID,LastName,FirstName,MiddleName,BirthDay")] Player player) { if (id != player.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(player); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlayerExists(player.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(player)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,name")] Team team) { if (id != team.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(team); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeamExists(team.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(team)); }
public static void Update(params Entity[] entities) { using (var context = new LeagueContext(options)) { foreach (var entity in entities) { context.Update(entity); } context.SaveChanges(); } }