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 abstract class UseCaseResponseMessage | |
{ | |
public bool Success { get; } | |
public string Message { get; } | |
protected UseCaseResponseMessage(bool success = false, string message = null) | |
{ | |
Success = success; | |
Message = message; | |
} |
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 GenericResponse<T> : UseCaseResponseMessage | |
{ | |
public T Data { get; } | |
public IEnumerable<Error> Errors { get; } | |
public GenericResponse(IEnumerable<Error> errors, bool success = false, string message = null) : base(success, message) | |
{ | |
Errors = errors; | |
} |
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
namespace Cms.Core.Dtos.Generals | |
{ | |
public sealed class Error | |
{ | |
public string Code { get; } | |
public string Description { get; } | |
public string Stack { get; } | |
public Error(string code, string description, string stack = "") | |
{ |
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.Net; | |
using Cms.Core.Dtos.Generals; | |
using Cms.Core.IUseCases; | |
namespace Cms.Api.Presenters | |
{ | |
public class PostApiPresenter<T> : IOutputPort<GenericResponse<T>> | |
{ |
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
public class AddPostRequest : IUseCaseRequest<GenericResponse<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 async Task<Post> Add(Post domain) | |
{ | |
var post = new Enities.Post | |
{ | |
Title = domain.Title, | |
CreatedDate = domain.CreatedDate, | |
ModifiedDate = domain.ModifiedDate, | |
Content = domain.Content | |
}; |
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.Threading.Tasks; | |
using Cms.Core.Dtos.Generals; | |
using Cms.Core.Dtos.UseCaseDtos; | |
using Cms.Core.Exceptions; | |
using Cms.Core.IRepositories; | |
using Cms.Core.IUseCases; | |
namespace Cms.Core.UseCases | |
{ |
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
[HttpGet("GetAll")] | |
public async Task<IActionResult> GetAll() | |
{ | |
var query = new GetAllPostQuery(); | |
} |
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 MediatR; | |
using System.Collections.Generic; | |
using Cms.Core.Dtos; | |
namespace Cms.Core.Queries | |
{ | |
public class GetAllPostQuery:IRequest<List<PostWithoutCommentsDto>> | |
{ | |
} |