示例#1
0
        public async Task <IActionResult> Post(int id)
        {
            if (id != 0)
            {
                Post post = postContext.GetById(id);

                if (User.Identity.Name != null)
                {
                    Gebruiker huidigeGebruiker = await gebruikerContext.GetByNaam(User.Identity.Name);

                    postContext.RecordCategoryVisit(post.Categorie, huidigeGebruiker);
                }

                return(View(post));
            }
            return(View(null));
        }
示例#2
0
        public Post GetById(int id)
        {
            PostDTO dto = new PostDTO();

            dto = context.GetById(id);
            Post post = converter.DtoToModel(dto);

            return(post);
        }
示例#3
0
        public IActionResult GetById([FromQuery] int id)
        {
            Post post = postContext.GetById(id);

            if (post == null)
            {
                return(NotFound());
            }
            return(new ObjectResult(post));
        }
 public Post GetById(int id)
 {
     return(context.GetById(id));
 }