public ActionResult Create(QuestionViewModel questionViewModel) { var nomeDasCategorias = questionViewModel.Categories.Split(','); var categories = _categoryService.ListCategoriesByName(nomeDasCategorias); var question = new Question() { Subject = questionViewModel.Subject, Description = questionViewModel.Description, }; question.Qualify(categories); _questionService.InsertQuestion(question); return RedirectToAction("New"); }
public ActionResult Show(int id) { ViewData["Home"] = ""; ViewData["Dica"] = ""; var dica = _questionService.GetQuestion(id); var questionViewModel = new QuestionViewModel { Subject = dica.Subject, Description = dica.Description }; foreach (var category in dica.Categories) { questionViewModel.Categories += "#" + category.Name; } return View(questionViewModel); }