Reorganizing the structure of the project, adding unit testing, adding PokemonService and ShakespeareService.
This commit is contained in:
25
Pokespearean.Models/Generic/WebResult.cs
Normal file
25
Pokespearean.Models/Generic/WebResult.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Pokespearean.Models.Generic
|
||||
{
|
||||
public class WebResult
|
||||
{
|
||||
[JsonIgnore]
|
||||
public bool IsValid { get; set; } = true;
|
||||
[JsonIgnore]
|
||||
public Exception Exception { get; set; }
|
||||
[JsonIgnore]
|
||||
public object Data { get; set; }
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
public WebResult Invalidate(string errorMessage, Exception exception = default)
|
||||
{
|
||||
IsValid = false;
|
||||
ErrorMessage = errorMessage;
|
||||
Exception = exception;
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user