This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python -m venv venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IUseCaseRequestHandler<in TUseCaseRequest, out TUseCaseResponse> where TUseCaseRequest : IUseCaseRequest<TUseCaseResponse> | |
{ | |
Task HandleAsync(TUseCaseRequest message, IOutputPort<TUseCaseResponse> outputPort); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IUseCaseRequest<out TUseCaseResponse> { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AddPostRequest : IUseCaseRequest<AddPostResponse> | |
{ | |
public string Title { get; set; } | |
public string Content { get; set; } | |
public DateTime CreatedDate { get; set; } | |
public DateTime ModifiedDate { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AddPostResponse | |
{ | |
public int Id { get; set; } | |
public string Title { get; set; } | |
public string Content { get; set; } | |
public DateTime CreatedDate { get; set; } | |
public DateTime ModifiedDate { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Text; | |
using Cms.Core.Dtos.Generals; | |
using Cms.Core.Dtos.UseCaseDtos; | |
namespace Cms.Core.IUseCases | |
{ | |
public interface IAddPostUseCase : IUseCaseRequestHandler<AddPostRequest, GenericResponse<AddPostResponse>> | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IOutputPort<in TUseCaseResponse> | |
{ | |
void Handle(TUseCaseResponse response); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Cms.Core.IUseCases; | |
namespace Cms.Api.Presenters | |
{ | |
public class PostApiPresenter<T> : IOutputPort<T> | |
{ | |
public JsonContentResult ContentResult { get; } | |
public PostApiPresenter() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Cms.Core.Domain; | |
using Cms.Core.Dtos.Generals; | |
using Cms.Core.Dtos.UseCaseDtos; | |
using Cms.Core.IRepositories; | |
using Cms.Core.IUseCases; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpPost] | |
public async Task<IActionResult> Add(AddPostVm model) | |
{ | |
await _addPostUseCase.HandleAsync(new AddPostRequest | |
{ | |
Content = model.Content, | |
Title = model.Title | |
}, _addApiPresenter); | |
return _addApiPresenter.ContentResult; |
OlderNewer