public async Task <IActionResult> Create(PostsCreateViewModel model) { if (ModelState.IsValid) { var input = ObjectMapper.Map <CreatePostInput>(model); await _postApplicationService.Create(input); return(RedirectToAction("Index")); } return(View(model)); }
public async Task <ActionResult> Create(string forumId) { var forumDb = await this.forumsService.GetById(forumId); var userDb = await this.userManager.GetUserAsync(User); var model = new PostsCreateViewModel { Forum = new ForumViewModel(forumDb), Author = new ApplicationUserViewModel(userDb), Post = new PostViewModel { AuthorId = userDb.Id, ForumId = forumDb.Id, } }; return(View(model)); }