public async Task <IActionResult> Edit(int id, [Bind("Id,SpeakerId,SponsorId,DiscussionId,ScheduledTime")] Schedule schedule) { if (id != schedule.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(schedule); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ScheduleExists(schedule.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DiscussionId"] = new SelectList(_context.Discussion, "Id", "Id", schedule.DiscussionId); ViewData["SpeakerId"] = new SelectList(_context.Set <Speaker>(), "Id", "Id", schedule.SpeakerId); ViewData["SponsorId"] = new SelectList(_context.Set <Sponsor>(), "Id", "Id", schedule.SponsorId); return(View(schedule)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Email")] Sponsor sponsor) { if (id != sponsor.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(sponsor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SponsorExists(sponsor.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(sponsor)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Topic,Description")] Discussion discussion) { if (id != discussion.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(discussion); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DiscussionExists(discussion.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(discussion)); }