2023-10-08 00:46:42 +02:00
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace SharpRSS.API.Contracts.Models
|
|
|
|
{
|
|
|
|
public class ResultOr<TValue> : Result
|
|
|
|
{
|
|
|
|
public ResultOr(TValue? value, string message, ResultStatus status) : base(message, status)
|
|
|
|
{
|
|
|
|
Value = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public TValue? Value { get; }
|
|
|
|
|
2023-10-09 01:58:53 +02:00
|
|
|
public static ResultOr<TValue> Ok(TValue? value) => new ResultOr<TValue>(value, "", ResultStatus.Ok);
|
2023-10-08 00:46:42 +02:00
|
|
|
public static ResultOr<TValue> Failed(string message = "Failed", ResultStatus status = ResultStatus.Failed) => new ResultOr<TValue>(default, message, status);
|
|
|
|
}
|
|
|
|
}
|