33 lines
1.3 KiB
C#

using DigitalData.Core.Contracts.Application;
namespace DigitalData.Core.Application
{
/// <summary>
/// Represents the outcome of a service operation, encapsulating the success or failure status,
/// and any associated messages.
/// </summary>
public class ServiceMessage : IServiceMessage
{
/// <summary>
/// Initializes a new instance of the ServiceMessage class with specified success status, and messages.
/// </summary>
/// <param name="isSuccess">Indicates whether the service operation was successful.</param>
/// <param name="data">The data associated with a successful operation.</param>
/// <param name="messages">An array of messages related to the operation's outcome.</param>
public ServiceMessage(bool isSuccess, params string[] messages)
{
IsSuccess = isSuccess;
Messages = messages.ToList<string>();
}
/// <summary>
/// Gets or sets a value indicating whether the service operation was successful.
/// </summary>
public bool IsSuccess { get; set; }
/// <summary>
/// Gets or sets a collection of messages associated with the service operation.
/// </summary>
public List<string> Messages { get; set; } = new List<string>();
}
}