Пример #1
0
        public async Task <IActionResult> GetAll()
        {
            var model = new AllTagsAdminInputModel()
            {
                Tags = await this.tagsService.GetAllAsync <TagAdminViewModel>(),
            };

            return(this.View(model));
        }
Пример #2
0
        public async Task <IActionResult> Add(AllTagsAdminInputModel input)
        {
            if (!this.ModelState.IsValid)
            {
                input.Tags = await this.tagsService.GetAllAsync <TagAdminViewModel>();

                return(this.View(input));
            }

            var isAdded = await this.tagsService.AddAsync(input.Name);

            if (isAdded)
            {
                this.TempData["InfoMessage"] = GlobalConstants.SuccessAddedMessage;
            }
            else
            {
                this.TempData["ErrorMessage"] = GlobalConstants.AlreadyExistingTag;
            }

            return(this.RedirectToAction(nameof(this.GetAll)));
        }