Exemplo n.º 1
0
        public async Task <ActionResult> Add(PostViewModel newPost)
        {
            var post = newPost.GetModel(newPost);

            post.CreatedAt       = DateTime.UtcNow;
            post.ApplicationUser = await this.userManager.FindByIdAsync(newPost.AuthorId);

            post.Forum = await this.forumsService.GetById(newPost.ForumId);

            await this.postsService.Create(post);

            // TODO: implement user rating management
            return(RedirectToAction("Index", "Posts", new { id = post.Id }));
        }