Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Question,AnswerA,HasTickA,AnswerB,HasTickB,AnswerC,HasTickC,AnswerD,HasTickD")] MultChoice multChoice)
        {
            if (id != multChoice.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(multChoice);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MultChoiceExists(multChoice.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(multChoice));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,Question,AnswerA,HasTickA,AnswerB,HasTickB,AnswerC,HasTickC,AnswerD,HasTickD")] MultChoice multChoice)
        {
            if (ModelState.IsValid)
            {
                _context.Add(multChoice);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(multChoice));
        }