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)); }
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 })); }
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 })); }
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 })); }