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

Add Result.Created void methods so that return Result type is implicitly handled. #200

Merged
merged 5 commits into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/Ardalis.Result/Result.Void.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,30 @@ public static Result<T> Success<T>(T value, string successMessage)
return new Result<T>(value, successMessage);
}

/// <summary>
/// Represents a successful operation that resulted in the creation of a new resource.
/// Accepts a value as the result of the operation.
/// </summary>
/// <param name="value">Sets the Value property</param>
/// <returns>A Result<typeparamref name="T"/></returns>
public static Result<T> Created<T>(T value)
{
return Result<T>.Created(value);
}

/// <summary>
/// Represents a successful operation that resulted in the creation of a new resource.
/// Accepts a value as the result of the operation.
/// Accepts a location for the new resource.
/// </summary>
/// <param name="value">Sets the Value property</param>
/// <param name="location">The location of the newly created resource</param>
/// <returns>A Result<typeparamref name="T"/></returns>
public static Result<T> Created<T>(T value, string location)
{
return Result<T>.Created(value, location);
}

/// <summary>
/// Represents an error that occurred during the execution of the service.
/// Error messages may be provided and will be exposed via the Errors property.
Expand Down
Loading