public IActionResult Create(int id) { var category = this.categoryService.GetById(id); var model = new ThreadInputModel { CategoryId = category.Id, }; return(this.View(model)); }
public async Task <IActionResult> Create(ThreadInputModel model) { if (!this.ModelState.IsValid) { return(this.View(model)); } var userId = this.userManager.GetUserId(this.User); var thread = await this.threadService.CreateNewThread(userId, model.CategoryId, model.Title, model.Content); return(this.RedirectToAction("Thread", "ForumThread", new { id = thread.Id })); }