Beispiel #1
0
 public PostsController(IGetPostsCommand getCommand, IGetPostCommand getOneCommand, IAddPostCommand addCommand, IEditPostCommand editCommand, IDeletePostCommand deleteCommand)
 {
     _getCommand    = getCommand;
     _getOneCommand = getOneCommand;
     _addCommand    = addCommand;
     _editCommand   = editCommand;
     _deleteCommand = deleteCommand;
 }
Beispiel #2
0
 public PostController(IGetPostsCommand getPostsCommand, IGetPostCommand getPostCommand, IAddPostCommand addPostCommand, IEditPostCommand editPostCommand, IDeletePostCommand deletePostCommand, LoggedUser loggedUser)
 {
     _getPostsCommand    = getPostsCommand;
     _getPostCommand     = getPostCommand;
     _addPostsCommand    = addPostCommand;
     _editPostsCommand   = editPostCommand;
     _deletePostsCommand = deletePostCommand;
     _loggedUser         = loggedUser;
 }
Beispiel #3
0
        public IActionResult Put(int id,
                                 [FromBody] PostDto dto,
                                 [FromServices] IEditPostCommand command)
        {
            dto.Id = id;

            _executor.ExecuteCommand(command, dto);
            return(NoContent());
        }
Beispiel #4
0
 public PostsController(BlogContext context, IGetPostsCommand getCommand, IGetPostCommand getOneCommand, IAddPostCommand addCommand, IEditPostCommand editCommand, IDeletePostCommand deleteCommand)
 {
     Context        = context;
     _getCommand    = getCommand;
     _getOneCommand = getOneCommand;
     _addCommand    = addCommand;
     _editCommand   = editCommand;
     _deleteCommand = deleteCommand;
 }
Beispiel #5
0
 public PostsController(Context context, IAddPostCommand addPost, IGetPostsCommand getPosts, IGetPostCommand getOnePost, IEditPostCommand editPost, IDeletePostCommand deletePost)
 {
     _context    = context;
     _addPost    = addPost;
     _getPosts   = getPosts;
     _getOnePost = getOnePost;
     _editPost   = editPost;
     _deletePost = deletePost;
 }
Beispiel #6
0
 public PostController(IGetPost postsCommand, IGetOnePostCommand getOne, IGetAddPost addPost, IDeletePost deletePost, IEditPostCommand editPost, LoggedUser loggedUser)
 {
     _postsCommand = postsCommand;
     _getOne       = getOne;
     _addPost      = addPost;
     _deletePost   = deletePost;
     _editPost     = editPost;
     _loggedUser   = loggedUser;
 }
 public PostsController(Context context, IGetPostsCommand getCommand, IGetPostCommand getOneCommand, IAddPostCommand addCommand, IEditPostCommand editCommand, IDeletePostCommand deleteCommand, IEmailSender emailSender)
 {
     _context       = context;
     _getCommand    = getCommand;
     _getOneCommand = getOneCommand;
     _addCommand    = addCommand;
     _editCommand   = editCommand;
     _deleteCommand = deleteCommand;
     _emailSender   = emailSender;
 }
Beispiel #8
0
 public PostController(IGetPostsCommand getPost, IGetCategory getCategory, IDeletePost deletePost, PostContext context, IGetOnePostCommand getOne, IEditPostCommand editPost, IGetAddPost addPost)
 {
     _getPost     = getPost;
     _getCategory = getCategory;
     _deletePost  = deletePost;
     _context     = context;
     _getOne      = getOne;
     _editPost    = editPost;
     _addPost     = addPost;
 }
 public PostsController(IGetPostsCommand getPosts, IGetPostCommand getOne, ICreatePostCommand postCreate, ICreateImageCommand imageCreate, IGetImageCommand getImage, IEditPostPictureCommand editImage, IEditPostCommand editPost, IDeletePostCommand deltePost)
 {
     _getPosts    = getPosts;
     _getOne      = getOne;
     _postCreate  = postCreate;
     _imageCreate = imageCreate;
     _getImage    = getImage;
     _editImage   = editImage;
     _editPost    = editPost;
     _deltePost   = deltePost;
 }
Beispiel #10
0
 public PostsController(IGetPostCommand getPost,
                        IGetPostsCommand getPosts,
                        IAddPostCommand addPost,
                        IEditPostCommand editPost,
                        IDeletePostCommand deletePost,
                        LoggedUser user)
 {
     _getPost    = getPost;
     _getPosts   = getPosts;
     _addPost    = addPost;
     _editPost   = editPost;
     _deletePost = deletePost;
     _user       = user;
 }
        public IActionResult Put(int id, [FromBody] AddPost dto, [FromServices] IEditPostCommand command)
        {
            try
            {
                dto.Id = id;
                executor.ExecuteCommand(command, dto);
                return(StatusCode(204, "Succesfully edited a post"));
            }
            catch (EntityNotFoundException e)
            {
                if (e.Message == "Product not found.")
                {
                    return(NotFound(e.Message));
                }

                return(UnprocessableEntity(e.Message));
            }
        }
Beispiel #12
0
 public PostsController(IGetPostsCommand getPosts,
                        IGetPostCommand getPost,
                        IDeletePostCommand deletePost,
                        IAddPostCommand addPost,
                        IGetCategoriesWithoutPaginationCommand getCategories,
                        IGetUsersWithoutPaginationCommand getUsers,
                        IGetTagsWithoutPaginationCommand getTags,
                        IEditPostCommand editPost)
 {
     _getPosts      = getPosts;
     _getPost       = getPost;
     _deletePost    = deletePost;
     _addPost       = addPost;
     _getCategories = getCategories;
     _getUsers      = getUsers;
     _getTags       = getTags;
     _editPost      = editPost;
 }
 public IActionResult Put(int id, [FromBody] EditPostDto request, [FromServices] IEditPostCommand command)
 {
     request.Id = id;
     _executor.ExecuteCommand(command, request);
     return(StatusCode(StatusCodes.Status204NoContent));
 }