API mostly working, starting to work on webapp

This commit is contained in:
Cameron
2024-08-23 23:52:36 -05:00
commit a4403ce17b
26 changed files with 1725 additions and 0 deletions

34
Models/RequestError.cs Normal file
View File

@@ -0,0 +1,34 @@
namespace ComiServ.Models
{
public class RequestError
{
public static RequestError InvalidHandle => new("Invalid handle");
public static RequestError ComicNotFound => new("Comic not found");
public static RequestError CoverNotFound => new("Cover not found");
public static RequestError PageNotFound => new("Page not found");
public static RequestError FileNotFound => new("File not found");
public string[] Errors { get; }
public RequestError(string ErrorMessage)
{
Errors = [ErrorMessage];
}
public RequestError(IEnumerable<string> ErrorMessages)
{
Errors = ErrorMessages.ToArray();
}
public RequestError And(RequestError other)
{
return new RequestError(Errors.Concat(other.Errors));
}
public RequestError And(string other)
{
return new RequestError(Errors.Append(other));
}
public RequestError And(IEnumerable<string> other)
{
return new RequestError(Errors.Concat(other))
;
}
}
}