コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Audio,Image,Answeres,CorrectAnswer,SerieId")] Question question)
        {
            if (id != question.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(question);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!QuestionExists(question.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(question));
        }
コード例 #2
0
 public Task <int> SaveAsync()
 {
     return(_Db.SaveChangesAsync());
 }