Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

ExecuteResultAsync

public class TestResult
{
    public Exception Exception { get; set; }
    public object Data { get; set; }
}

public class TestActionResult : IActionResult
{
    private readonly TestResult _result;

    public TestActionResult(TestResult result)
    {
        _result = result;
    }

    public async Task ExecuteResultAsync(ActionContext context)
    {
        var objectResult = new ObjectResult(_result.Exception ?? _result.Data)
        {
            StatusCode = _result.Exception != null
                ? StatusCodes.Status500InternalServerError
                : StatusCodes.Status200OK
        };

        await objectResult.ExecuteResultAsync(context);
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: back color for DateTimePicker control 
Csharp :: Unity android plugin callback 
Csharp :: get appsetting.json config .net 
Csharp :: how to show enum name list from input in swagger c# 
Csharp :: convert string csv line to list c# 
Csharp :: GridViewColumn url wpf 
Csharp :: edit opened excel file directly 
Csharp :: How do I remove a String Array from a List in C# 
Csharp :: Photon Join Room 
Csharp :: c# linq query map to entity 
Csharp :: last word of string to uppercase c# 
Csharp :: stuck.hypixel.net ip 
Csharp :: SerializedObjectNotCreatableException: Object at index 0 is null 
Csharp :: 1180 - Lowest Number and Position C# 
Csharp :: csharp test for null 
Csharp :: collection to datatable c# 
Csharp :: c# variable 
Csharp :: world space constant size 
Csharp :: how to clone something as a parent unity 
Csharp :: c# encrypt folder SHA512 
Csharp :: custom player spawner mirror 
Csharp :: How to truncate a decimal without rounding 
Csharp :: snakes and ladder single player c# 
Csharp :: wpf string to byte array 
Csharp :: mvc validate 
Csharp :: how to initialize array in c# 
Csharp :: c# sprintf equivalent 
Csharp :: ascii art american flag 
Csharp :: download and run exe c# 1 button 
Csharp :: enable asnotracking in asp.net core at global level 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =