public async Task <IActionResult> Edit(Guid id, [Bind("Id,Option,CourseChapterExamId,IsCorrectAnswer,IsDeleted,Mark")] CourseChapterChoice courseChapterChoice)
        {
            if (id != courseChapterChoice.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(courseChapterChoice);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CourseChapterChoiceExists(courseChapterChoice.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                var coursechapterexam = _context.CourseChapterExams.SingleOrDefault(c => c.Id == courseChapterChoice.CourseChapterExamId);
                return(RedirectToAction("Edit", "CourseChapters", new { id = coursechapterexam.CourseChapterId }));
            }
            ViewData["CourseChapterExamId"] = new SelectList(_context.CourseChapterExams, "Id", "Question", courseChapterChoice.CourseChapterExamId);
            return(View(courseChapterChoice));
        }
        public async Task <IActionResult> Create([Bind("Id,Option,CourseChapterExamId,IsCorrectAnswer,IsDeleted,Mark")] CourseChapterChoice courseChapterChoice)
        {
            if (ModelState.IsValid)
            {
                courseChapterChoice.Id = Guid.NewGuid();
                _context.Add(courseChapterChoice);
                await _context.SaveChangesAsync();

                courseChapterChoice.IsDeleted = false;
                var courseexam = _context.CourseChapterExams.Include(c => c.CourseChapter).SingleOrDefault(c => c.Id == courseChapterChoice.CourseChapterExamId);
                return(RedirectToAction("Edit", "CourseChapters", new { id = courseexam.CourseChapterId }));
            }
            ViewData["CourseChapterExamId"] = new SelectList(_context.CourseChapterExams, "Id", "Question", courseChapterChoice.CourseChapterExamId);
            return(View(courseChapterChoice));
        }