public async Task<IHttpActionResult> Post(TriviaQuestion triviaQuestion)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var lastDisplayOrder = await this.db.TriviaQuestions
            .OrderByDescending(q => q.DisplayOrder)
            .Select(q => q.DisplayOrder)
            .FirstOrDefaultAsync();
            triviaQuestion.DisplayOrder = lastDisplayOrder + 1;
            db.TriviaQuestions.Add(triviaQuestion);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (TriviaQuestionExists(triviaQuestion.Id))
                {
                    return Conflict();
                }
                else
                {
                    throw;
                }
            }

            return CreatedAtRoute("DefaultApi", new { id = triviaQuestion.Id }, triviaQuestion);
        }
 public async Task<IActionResult> Edit(TriviaQuestion triviaQuestion)
 {
     if (ModelState.IsValid)
     {
         _context.Update(triviaQuestion);
         await _context.SaveChangesAsync();
         return RedirectToAction("Index");
     }
     return View(triviaQuestion);
 }