public async Task <IActionResult> Edit(int id, [Bind("Id,ApplicationUserId,AnswerDate,CourseChapterChoiceId")] CourseChapterExamLog courseChapterExamLog) { if (id != courseChapterExamLog.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(courseChapterExamLog); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CourseChapterExamLogExists(courseChapterExamLog.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", courseChapterExamLog.ApplicationUserId); return(View(courseChapterExamLog)); }
public async Task <IActionResult> Create([Bind("Id,ApplicationUserId,AnswerDate,CourseChapterChoiceId")] CourseChapterExamLog courseChapterExamLog) { if (ModelState.IsValid) { _context.Add(courseChapterExamLog); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", courseChapterExamLog.ApplicationUserId); return(View(courseChapterExamLog)); }