コード例 #1
0
        public async Task <IActionResult> Title(SurveyBindingModel model)
        {
            if (ModelState.IsValid)
            {
                var surveyModel = model.ToServiceModel();

                await _surveyService.EditSurveyAsync(surveyModel);

                return(RedirectToAction($"Edit", "Survey", new { SurveyId = surveyModel.Id }));
            }

            return(View(model));
        }
コード例 #2
0
        public async Task <IActionResult> Create([FromForm] SurveyBindingModel model)
        {
            if (ModelState.IsValid)
            {
                var    surveyModel = model.ToServiceModel();
                string email       = User.Identity.Name;

                await _surveyService.CreateSurveyAsync(surveyModel, email);

                return(RedirectToAction($"Create", "Question", new { surveyId = surveyModel.Id }));
            }

            return(View(model));
        }