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)); }
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)); }