public async Task <IActionResult> Post([FromForm] AddPostRequest request, [FromServices] IAddPostUseCase useCase) { useCase.SetOutputPort(this); var userId = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; await useCase.ExecuteAsync(userId, request.Title, request.Content, request.Image.OpenReadStream(), System.IO.Path.GetExtension(request.Image.FileName)) .ConfigureAwait(false); return(_viewModel); }
public PostController( IMediator mediator, IPostService postService, IAddPostUseCase addPostUseCase, IDeletePostUseCase deletePostUseCase, PostApiPresenter <bool> deleteApiPresenter, PostApiPresenter <AddPostResponse> addApiPresenter ) { _mediator = mediator; _postService = postService; _addPostUseCase = addPostUseCase; _deletePostUseCase = deletePostUseCase; _deleteApiPresenter = deleteApiPresenter; _addApiPresenter = addApiPresenter; }
public PostController( IAddPostUseCase addPostUseCase, IRemovePostUseCase removePostUseCase, IUpdatePostUseCase updatePostUseCase, IGetAllPostUseCase getAllPostUseCase, IGetByIdPostUseCase getByIdPostUseCase, IGetByIdTopicUseCase getByIdTopicUseCase, IGetByIdUserUseCase getByIdUserUseCase) { this.addPostUseCase = addPostUseCase; this.removePostUseCase = removePostUseCase; this.updatePostUseCase = updatePostUseCase; this.getAllPostUseCase = getAllPostUseCase; this.getByIdPostUseCase = getByIdPostUseCase; this.getByIdTopicUseCase = getByIdTopicUseCase; this.getByIdUserUseCase = getByIdUserUseCase; }