SharpRSS/SharpRSS.API.Contracts/Models/ResultOr.cs
2024-06-16 13:43:30 +02:00

17 lines
577 B
C#
Executable File

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; }
public static ResultOr<TValue> Ok(TValue? value) => new ResultOr<TValue>(value, "", ResultStatus.Ok);
public static ResultOr<TValue> Failed(string message = "Failed", ResultStatus status = ResultStatus.Failed) => new ResultOr<TValue>(default, message, status);
}
}