예제 #1
0
        public async Task <IActionResult> CreateAsync(CreatePostDto newPost)
        {
            var post = await _postService.AddNewPostAsync(newPost);

            return(Created($"api/posts/{post.Id}", new Response <PostDto>(post)));
        }
예제 #2
0
 public IActionResult AddPost(string postText)
 {
     _postService.AddNewPostAsync(User.Identity.Name, postText);
     return(RedirectToAction("Index", "Home"));
 }
예제 #3
0
        public async Task <IActionResult> Create(CreatePostDto newPost)
        {
            var post = await _postService.AddNewPostAsync(newPost, User.FindFirstValue(ClaimTypes.NameIdentifier));

            return(Created($"api/posts/{post.Id}", new Response <PostDto>(post)));
        }
예제 #4
0
 public IActionResult AfterAddNewPost(Post post)
 {
     postService.AddNewPostAsync(post);
     return(RedirectToAction(nameof(Index), "Home", postService.RankPosts(applicationContext.Posts.ToList())));
 }