예제 #1
0
        public IActionResult Add()
        {
            AddNewTagDisplayViewModel model = new AddNewTagDisplayViewModel();

            model.TagsForDisplay = tagRepository.GetAll().ToList();

            return(View(model));
        }
예제 #2
0
        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));
        }