public async Task <IActionResult> Edit(int id, [Bind("ThiId,TenThi,NguoiDungId")] Thi thi) { if (id != thi.ThiId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(thi); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ThiExists(thi.ThiId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["NguoiDungId"] = new SelectList(_context.NguoiDungs, "NguoiDungId", "DiaChi", thi.NguoiDungId); return(View(thi)); }
public async Task <IActionResult> Edit(int id, [Bind("CauHoiId,ThiId")] CauHoiThi cauHoiThi) { if (id != cauHoiThi.CauHoiId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cauHoiThi); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CauHoiThiExists(cauHoiThi.CauHoiId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CauHoiId"] = new SelectList(_context.CauHois, "CauHoiId", "CauTraLoi1", cauHoiThi.CauHoiId); ViewData["ThiId"] = new SelectList(_context.Thi, "ThiId", "TenThi", cauHoiThi.ThiId); return(View(cauHoiThi)); }
public async Task <IActionResult> Edit(int id, [Bind("DapAnId,TenDapAn,CauHoiId")] DapAn dapAn) { if (id != dapAn.DapAnId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(dapAn); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DapAnExists(dapAn.DapAnId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CauHoiId"] = new SelectList(_context.CauHois, "CauHoiId", "TenCauHoi", dapAn.CauHoiId); return(View(dapAn)); }
public async Task <IActionResult> Edit(int id, [Bind("NguoiDungId,Email,MatKau,XacNhanMatKhau,DiaChi,PhotoPath")] NguoiDung nguoiDung) { if (id != nguoiDung.NguoiDungId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(nguoiDung); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NguoiDungExists(nguoiDung.NguoiDungId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(nguoiDung)); }