session-companion/SessionCompanion/SessionCompanion.ViewModels/ApiResponses/ErrorResponse.cs

57 lines
1.3 KiB
C#

using System.Text.Json;
namespace SessionCompanion.ViewModels.ApiResponses
{
public class ErrorResponse
{
/// <summary>
/// Pusty konstruktor
/// </summary>
public ErrorResponse()
{ }
/// <summary>
/// Konstruktor obiektu
/// </summary>
/// <param name="code"></param>
public ErrorResponse(int code)
{
this.StatusCode = code;
}
/// <summary>
/// Konstruktor obiektu
/// </summary>
/// <param name="message"></param>
public ErrorResponse(string message)
{
this.Message = message;
}
/// <summary>
/// Konstruktor obiektu
/// </summary>
/// <param name="code"></param>
/// <param name="message"></param>
public ErrorResponse(int code, string message)
{
this.StatusCode = code;
this.Message = message;
}
/// <summary>
/// Kod błędu
/// </summary>
public int StatusCode { get; set; }
/// <summary>
/// Wiadomość błędu do pokazania
/// </summary>
public string Message { get; set; }
public override string ToString()
{
return JsonSerializer.Serialize(this);
}
}
}