public async Task <IActionResult> Edit(int id, [Bind("Id,Means,wordclass,vocabularyId")] MeanChinese meanChinese) { if (id != meanChinese.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(meanChinese); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MeanChineseExists(meanChinese.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["vocabularyId"] = new SelectList(_context.vocabularies, "Id", "Id", meanChinese.vocabularyId); return(View(meanChinese)); }
public async Task <IActionResult> Create([Bind("Id,Means,wordclass,vocabularyId")] MeanChinese meanChinese) { if (ModelState.IsValid) { _context.Add(meanChinese); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index), "Vocabularies")); } ViewData["vocabularyId"] = new SelectList(_context.vocabularies, "Id", "Id", meanChinese.vocabularyId); return(View(meanChinese)); }
public IActionResult Exam() { MeanChinese examwords = takewords(); if (examwords == null) { return(RedirectToAction("Index")); } ViewBag.examwords = examwords; // return Json(result); return(View()); }