Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        public IActionResult Exam()
        {
            MeanChinese examwords = takewords();

            if (examwords == null)
            {
                return(RedirectToAction("Index"));
            }
            ViewBag.examwords = examwords;
            // return Json(result);
            return(View());
        }