예제 #1
0
        public ActionResult Create()
        {
            var emptyQuestion = new SurveyCreatingModel(_surveyRepository, _categoryRepository);

            emptyQuestion.Question = "";
            emptyQuestion.QuestionOptions.Add(new KeyValuePair <string, bool>("", true));

            return(View("~/Views/Survey/Create.cshtml", emptyQuestion));
        }
예제 #2
0
        public ActionResult Create(string Question, Dictionary <string, bool> QuestionOptions, long CategoryId)
        {
            //Question, QuestionOptions, CategoryId
            var model = new SurveyCreatingModel(_surveyRepository, _categoryRepository)
            {
                CategoryId      = CategoryId,
                QuestionOptions = QuestionOptions.ToList(),
                Question        = Question
            };

            if (model.IsValid)
            {
                model.Save();
                return(RedirectToAction("Index", new RouteValueDictionary {
                    { "CategoryId", CategoryId }
                }));
            }

            return(View("~/Views/Survey/Create.cshtml", model));
        }