public ActionResult <Post> AddPost(Post newPost) { Post post = postDAO.AddPost(newPost); if (post != null) { return(Ok(post)); } else { return(NotFound()); } }
public ActionResult AddPost(AddPostViewModel model, Discussion discussion) { //Map the new post values for NewPost model to be pushed into database if (ModelState.IsValid) { var post = new Post(); post.Title = model.Title; post.Content = model.Content; post.Created = DateTime.Now; //logic for adding post with user and discussion id is processed in the POSTDAO _postService.AddPost(post, discussion); return(RedirectToAction("GetPost", "Post", new { id = post.Id })); } return(View(model)); }
public void AddPost(Post post, Discussion discussion) { _dao.AddPost(post, discussion); }