コード例 #1
0
        public async Task <IActionResult> Create(CreateTagInputModel inputModel)
        {
            if (this.ModelState.IsValid)
            {
                await this.tagsService.AddTag(inputModel.Title);

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

            return(this.RedirectToAction(nameof(this.Create)));
        }
コード例 #2
0
        public async Task <IActionResult> Create(CreateTagInputModel inputModel)
        {
            if (!ModelState.IsValid)
            {
                return(this.View(inputModel));
            }

            var tagId = await this.tagService.Create(inputModel.Name);

            if (string.IsNullOrEmpty(tagId))
            {
                return(this.Redirect("/"));
            }

            return(RedirectToAction(nameof(All)));
        }