public async Task <IActionResult> CreateAsync(CreatePostDto newPost) { var post = await _postService.AddNewPostAsync(newPost); return(Created($"api/posts/{post.Id}", new Response <PostDto>(post))); }
public IActionResult AddPost(string postText) { _postService.AddNewPostAsync(User.Identity.Name, postText); return(RedirectToAction("Index", "Home")); }
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))); }
public IActionResult AfterAddNewPost(Post post) { postService.AddNewPostAsync(post); return(RedirectToAction(nameof(Index), "Home", postService.RankPosts(applicationContext.Posts.ToList()))); }