public async Task <IActionResult> Edit(int id, [Bind("PendaftaranModelID,PenggunaModelID,WebinarModelID")] PendaftaranModel pendaftaranModel) { if (id != pendaftaranModel.PendaftaranModelID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(pendaftaranModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PendaftaranModelExists(pendaftaranModel.PendaftaranModelID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PenggunaModelID"] = new SelectList(_context.PenggunaModels, "PenggunaID", "PenggunaID", pendaftaranModel.PenggunaModelID); ViewData["WebinarModelID"] = new SelectList(_context.WebinarModels, "WebinarModelID", "JudulWebinar", pendaftaranModel.WebinarModelID); return(View(pendaftaranModel)); }
public async Task <IActionResult> Create([Bind("PendaftaranModelID,PenggunaModelID,WebinarModelID")] PendaftaranModel pendaftaranModel) { if (ModelState.IsValid) { _context.Add(pendaftaranModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PenggunaModelID"] = new SelectList(_context.PenggunaModels, "PenggunaID", "NamaPanjang", pendaftaranModel.PenggunaModelID); ViewData["WebinarModelID"] = new SelectList(_context.WebinarModels, "WebinarModelID", "JudulWebinar", pendaftaranModel.WebinarModelID); return(View(pendaftaranModel)); }