Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int?id,
                                               [FromServices] ICategoryServices categoryServices)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var post = await postServices.Get(id.Value);

            if (post == null)
            {
                return(NotFound());
            }

            CreatePostViewModel createPostViewModel = await ConfigureCreatePostViewModel(categoryServices, post, null);

            return(View(createPostViewModel));
        }
Exemplo n.º 2
0
 public async Task <IList <PostDto> > GetPostsAsync()
 {
     return(await _postServices.Get());
 }
Exemplo n.º 3
0
        public async Task <PostDto> GetPostAsync(string postId)
        {
            var result = ValidateId(postId);

            return(await _postServices.Get(result));
        }