// GET: Posts/Details/5 public ActionResult Details(int id) { var model = _db.Get(id); ViewBag.DateCreated = model.DateCreated.ToString("dddd , MMM dd yyyy,hh:mm"); ViewBag.DateEdited = model.DateEdited.ToString("dddd , MMM dd yyyy,hh:mm"); if (model == null) { return(HttpNotFound()); } return(View(model)); }
public IActionResult OnGet(int id) { Post = _postData.Get(id); if (Post == null) { return(RedirectToAction("Index", "Home")); } return(Page()); }
public IActionResult OnGet(int?id) { Post = _postData.Get(id); if (Post == null) { return(RedirectToPage("/Index")); } return(Page()); }
public Comment Add(Comment comment, int postId) { var post = _postData.Get(postId); comment.Post = post; _context.Comments.Add(comment); _context.SaveChanges(); return(comment); }
public IActionResult Details(int id) { var model = new DetailPostViewModel { Post = _postData.Get(id) }; if (model == null) { return(RedirectToAction(nameof(Index))); } return(View(model)); }
public ActionResult PostDetails(int id) { var post = postData.Get(id); if (post == null) { return(View("NotFound")); } var model = new PostViewModel { Post = post, Comments = commentData.GetAllForPost(post.ID) }; return(View(model)); }
public IActionResult Details(int id) { var post = _postData.Get(id); if (post == null) { return(RedirectToAction("Index")); } var dvm = new DetailsViewModel() { Post = post, Comments = _commentData.GetByPost(post.Id) }; return(View(dvm)); }
public Post Get(int id) { return(source.Get(id)); }
public IActionResult Get(int id) { var cm = _repo.Get(id); return(Ok(cm)); }