Ejemplo n.º 1
0
        private IActionResult CustomOk(object data)
        {
            DtoWrapper goodResult = new DtoWrapper
            {
                Id   = HttpContext.TraceIdentifier,
                Data = data
            };

            return(StatusCode(StatusCodes.Status200OK, goodResult));
        }
Ejemplo n.º 2
0
        private IActionResult CustomInternalServerError(string message)
        {
            DtoWrapper errorResult = new DtoWrapper
            {
                Id    = HttpContext.TraceIdentifier,
                Data  = null,
                Error = new ErrorData
                {
                    StatusCode = StatusCodes.Status404NotFound,
                    Message    = message
                }
            };

            return(StatusCode(StatusCodes.Status500InternalServerError, errorResult));
        }
Ejemplo n.º 3
0
        private IActionResult CustomNotFound()
        {
            DtoWrapper errorResult = new DtoWrapper
            {
                Id    = HttpContext.TraceIdentifier,
                Data  = null,
                Error = new ErrorData
                {
                    StatusCode = StatusCodes.Status404NotFound,
                    Message    = "Not found."
                }
            };

            return(StatusCode(StatusCodes.Status404NotFound, errorResult));
        }
Ejemplo n.º 4
0
 public DataTransportException(DtoWrapper <T> dto) : base($"{dto.Error}:  {dto.ErrorDescription}")
 {
 }