public IActionResult Index(Post post) { pd.AddPost(post); pd.Commit(); //ViewBag.message = "Posted Successfully"; return(RedirectToAction("MyPost", "Post", new { Id })); // return View(); }
public ActionResult <Post> GetPostLike(int id) { var post = _postData.GetPostById(id); post.LikeCount++; _postData.Commit(); if (post == null) { return(NotFound()); } return(post); }
public ActionResult <User> PostUser(User user) { _postData.AddUser(user); _postData.Commit(); return(CreatedAtAction("GetUser", new { email = user.Email }, user)); }
public ActionResult <Comment> PostComment(Comment comment) { _postData.AddComment(comment); _postData.Commit(); return(Ok("Sucessfully Added Comment")); }
public IActionResult Create(PostEditViewModel post) { if (ModelState.IsValid) { var newPost = new Post(); newPost.Title = post.Title; newPost.Type = post.Type; newPost.Content = post.Content; newPost.Upvotes = 1; newPost.Downvotes = 0; newPost.Poster = _userManager.GetUserAsync(User).Result; newPost = _postData.Add(newPost); _postData.Commit(); return(RedirectToAction("Details", new { id = newPost.Id })); } return(View()); }
public IActionResult OnPost(int postId) { var post = postData.DeletePost(postId); postData.Commit(); if (post == null) { return(RedirectToPage("./NotFound")); } return(RedirectToPage("./List")); }
public IActionResult Index(Comment comment, int id) { pd.AddComment(comment); pd.Commit(); return(RedirectToAction("MyPost", "Post", new { id })); }
public IActionResult LikePost(int postId) { pd.incrementLike(postId); pd.Commit(); return(RedirectToAction("AllPost", "Post")); }