public IActionResult Add() { AddNewTagDisplayViewModel model = new AddNewTagDisplayViewModel(); model.TagsForDisplay = tagRepository.GetAll().ToList(); return(View(model)); }
public IActionResult Add(AddNewTagGetViewModel model) { if (ModelState.IsValid) { Tag tag = new Tag { Title = model.Title, }; tagRepository.Add(tag); return(RedirectToAction("Index")); } AddNewTagDisplayViewModel modelForDisplay = new AddNewTagDisplayViewModel { Title = model.Title }; modelForDisplay.TagsForDisplay = tagRepository.GetAll().ToList(); return(View(modelForDisplay)); }