public async Task <IActionResult> Edit(int id, [Bind("ID,test_code,id_question")] quests_of_test quests_of_test) { if (id != quests_of_test.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(quests_of_test); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!quests_of_testExists(quests_of_test.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["id_question"] = new SelectList(_context.questions, "id_question", "id_question", quests_of_test.id_question); ViewData["test_code"] = new SelectList(_context.tests, "test_code", "test_code", quests_of_test.test_code); return(View(quests_of_test)); }
public async Task <IActionResult> Edit(int id, [Bind("test_code,test_name,id_subject,total_questions")] test test) { if (id != test.test_code) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(test); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!testExists(test.test_code)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["id_subject"] = new SelectList(_context.subjects, "id_subject", "id_subject", test.id_subject); return(View(test)); }
public async Task <IActionResult> Edit(int id, [Bind("id_student,username,password,email,name,gender,birthday,phone")] student student) { if (id != student.id_student) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(student); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!studentExists(student.id_student)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(student)); }
public async Task <IActionResult> Edit(int id, [Bind("id_question,id_subject,content,answer_a,answer_b,answer_c,answer_d,correct_answer")] question question) { if (id != question.id_question) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(question); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!questionExists(question.id_question)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["id_subject"] = new SelectList(_context.subjects, "id_subject", "id_subject", question.id_subject); return(View(question)); }
public async Task <IActionResult> Edit(int id, [Bind("id_score,score_number,detail,id_student,test_code")] score score) { if (id != score.id_score) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(score); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!scoreExists(score.id_score)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["id_student"] = new SelectList(_context.students, "id_student", "id_student", score.id_student); ViewData["test_code"] = new SelectList(_context.tests, "test_code", "test_code", score.test_code); return(View(score)); }
public async Task <IActionResult> Edit(int id, [Bind("id_subject,subject_name")] subject subject) { if (id != subject.id_subject) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(subject); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!subjectExists(subject.id_subject)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(subject)); }