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

57 lines
1.3 KiB
C#
Raw Permalink Normal View History

2020-12-10 17:34:30 +01:00
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;
}
2020-12-10 17:34:30 +01:00
/// <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);
}
}
}