Esempio n. 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));
        }
Esempio n. 2
0
        public Post GetById(int id)
        {
            PostDTO dto = new PostDTO();

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

            return(post);
        }
Esempio n. 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));
 }