Пример #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));
        }
Пример #2
0
 public async Task <IList <PostDto> > GetPostsAsync()
 {
     return(await _postServices.Get());
 }
Пример #3
0
        public async Task <PostDto> GetPostAsync(string postId)
        {
            var result = ValidateId(postId);

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