ErrorResponseDto.cs 519 B

123456789101112131415161718192021222324252627
  1. using System.Text.Json;
  2. namespace Products.Common.Dtos
  3. {
  4. public class ErrorResponseDto
  5. {
  6. public List<ErrorDto> Errors { get; set; } = new();
  7. public int StatusCode { get; set; }
  8. public override string ToString()
  9. {
  10. return JsonSerializer.Serialize(this);
  11. }
  12. }
  13. public class ErrorDto
  14. {
  15. public ErrorDto(string property, string error)
  16. {
  17. Property = property;
  18. Error = error;
  19. }
  20. public string Property { get; set; }
  21. public string Error { get; set; }
  22. }
  23. }