2020-12-10 17:34:30 +01:00
|
|
|
|
using System.Text.Json;
|
|
|
|
|
|
|
|
|
|
namespace SessionCompanion.ViewModels.ApiResponses
|
|
|
|
|
{
|
|
|
|
|
public class ErrorResponse
|
|
|
|
|
{
|
2021-01-20 21:06:28 +01:00
|
|
|
|
/// <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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|