示例#1
0
        public async Task<ActionResult> Edit(int id, Questionnaire questionnaire)
        {
            await commandHandlerDisptcher.HandleAsync<UpdateAnswersCommand, Questionnaire>(new UpdateAnswersCommand { Id = id, Questionnaire = questionnaire });

            TempData["Message"] = "The questionnaire answers have successfully been updated.";
            return RedirectToAction("Edit", "Home", new { id });
        }
示例#2
0
        public async Task<ActionResult> Index(Questionnaire questionnaire)
        {
            if (!ModelState.IsValid)
            {
                return View(questionnaire);
            }

            var result = await commandHandlerDisptcher.HandleAsync<CreateAnswersCommand, Questionnaire>(new CreateAnswersCommand {Questionnaire = questionnaire});

            TempData["Message"] = "Thanks for completing the questionnaire";
            return RedirectToAction("Index", "Home");
        }