Esempio n. 1
0
        public async Task <IActionResult> Create(CreateJokeInputModel model)
        {
            if (!ModelState.IsValid)
            {
                return(this.View(model));
            }
            var id = this.jokesService.Create(model.CategoryId, model.Content);

            return(this.RedirectToAction("Details", id));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create(CreateJokeInputModel input)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(input));
            }

            var id = await this.jokesService.Create(input.CategoryId, input.Content);

            return(this.RedirectToAction("Details", new { id = id }));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create(CreateJokeInputModel joke)
        {
            if (!ModelState.IsValid)
            {
                return(View(joke));
            }

            var id = await jokesService.CreateJokeAsync(joke.CategoriId, joke.Content);

            return(RedirectToAction("Details", new { id }));
        }
Esempio n. 4
0
        public async Task <IActionResult> Create(CreateJokeInputModel input)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(input));
            }

            var sanitizedContent = this.htmlSanitizerService.Sanitize(input.Content);

            var id = await this.jokesService.Create(input.CategoryId, sanitizedContent);

            return(this.RedirectToAction(nameof(Details), new { id }));
        }