Пример #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));
        }
Пример #4
0
 public Post GetById(int id)
 {
     return(context.GetById(id));
 }