public async Task <IActionResult> ManageTriviaQuestion(TriviaQuestionEditModel model)
        {
            model.Validate(ModelState);

            if (ModelState.IsValid)
            {
                var req = model.MapToRequest();
                await _mediator.Send(req);

                TempData["Flash"] = "Trivia question updated";
                return(RedirectToAction("ManageTriviaQuestions"));
            }

            return(View(model));
        }
        public async Task <IActionResult> SubmitTriviaQuestion(TriviaQuestionEditModel model)
        {
            model.Validate(ModelState);

            if (ModelState.IsValid)
            {
                var req = model.MapToRequest();
                req.Approved    = false; // always false when first being submitted
                req.SubmittedBy = User.Identity.Name;
                await _mediator.Send(req);

                TempData["Flash"] = "Thank you for submitting a trivia question! Submit another one!";
                return(RedirectToAction("SubmitTriviaQuestion"));
            }

            return(View(model));
        }