Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translating Results to ActionResults doesn't contain the SuccessMessage #114

Open
shahabfar opened this issue Feb 12, 2023 · 3 comments
Open
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@shahabfar
Copy link

Translating Results to ActionResults doesn't contain the SuccessMessage.
I want to send a message by SuccessMessage in ActionResult<Result> return type but this only return the T generic class without SuccessMessage property of Result class.

@shahabfar shahabfar changed the title Translating Results to ActionResults doesn't content the SuccessMessage Translating Results to ActionResults doesn't contain the SuccessMessage Feb 12, 2023
@ardalis ardalis added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels Feb 24, 2023
@ardalis
Copy link
Owner

ardalis commented Feb 24, 2023

Are you literally trying to use ActionResult<Result> ? Because typically you would use Result<OrderDTO> and translate that into ActionResult<OrderDTO> or something like that.

@Jad-EL
Copy link

Jad-EL commented Feb 25, 2023

In case of success, the "ToActionResult" only returns the T Value, nothing else.
image

Is it an expected behavior ? Because I'm trying to return a PagedResult for pagination, but I only have the list.

image

Am I doing something wrong ?

Thanks in advance :)

PS : Thanks a lot for all your work Ardalis, I learnt so much things thank to your open source projects and pdfs !

@ardalis
Copy link
Owner

ardalis commented May 16, 2024

I'm not sure what I should be doing with the SuccessMessage in your scenario.

Here's the code in question:
image

I'm just calling out to controller.StatusCode() which only has two overloads:
int statusCode
int statusCode, object? value

Where would I pass the SuccessMessage ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants