Пример #1
0
        public async Task <IActionResult> Edit(string id, [Bind("Id,QuizId,PlayedDt,SubmittedDt,Attempt,QuestCount,Result,ResultAdjusted,Feedback,CreatedBy,CreatedDate,ModifiedBy,ModifiedDate")] MoPlayResult moPlayResult)
        {
            if (id != moPlayResult.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(moPlayResult);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MoPlayResultExists(moPlayResult.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["QuizId"] = new SelectList(_context.MoQuizDetail, "Id", "Id", moPlayResult.QuizId);
            return(View(moPlayResult));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("Id,QuizId,PlayedDt,SubmittedDt,Attempt,QuestCount,Result,ResultAdjusted,Feedback,CreatedBy,CreatedDate,ModifiedBy,ModifiedDate")] MoPlayResult moPlayResult)
        {
            if (ModelState.IsValid)
            {
                _context.Add(moPlayResult);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["QuizId"] = new SelectList(_context.MoQuizDetail, "Id", "Id", moPlayResult.QuizId);
            return(View(moPlayResult));
        }