public async Task <IActionResult> Edit(string id, [Bind("ID,NamHoc,HocKi,Mon,DiemGK,DiemCK,KhoaID,MonHocID")] LopHocPhan lopHocPhan) { if (id != lopHocPhan.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(lopHocPhan); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LopHocPhanExists(lopHocPhan.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["KhoaID"] = new SelectList(_context.Khoas, "ID", "ID", lopHocPhan.KhoaID); ViewData["MonHocID"] = new SelectList(_context.MonHocs, "ID", "ID", lopHocPhan.MonHocID); return(View(lopHocPhan)); }
public async Task <IActionResult> Edit(string id, [Bind("ID,HoTen,Namsinh,Phone,LopHocPhanID")] SinhVien sinhVien) { if (id != sinhVien.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(sinhVien); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SinhVienExists(sinhVien.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["LopHocPhanID"] = new SelectList(_context.LopHocPhans, "ID", "ID", sinhVien.LopHocPhanID); return(View(sinhVien)); }
public async Task <IActionResult> Edit(string id, [Bind("ID,TenKhoa")] Khoa khoa) { if (id != khoa.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(khoa); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!KhoaExists(khoa.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(khoa)); }
public async Task <IActionResult> Edit(string id, [Bind("ID,TenMon,SoTinChi")] MonHoc monHoc) { if (id != monHoc.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(monHoc); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MonHocExists(monHoc.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(monHoc)); }