Template
mirror of
https://github.com/egmont11/ASP.Net-Core-MVC-Template.git
synced 2026-07-24 07:09:56 +02:00
Base template solution with tests, authentication, support for admin accounts, prepared tests for auth, basic error handling system used in auth.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
namespace TemplateWeb.Models;
|
||||
|
||||
public class ServiceResult
|
||||
{
|
||||
public bool Success { get; protected set; }
|
||||
public string Message { get; protected set; } = string.Empty;
|
||||
|
||||
public static ServiceResult Ok() => new ServiceResult { Success = true };
|
||||
public static ServiceResult Failure(string message) => new ServiceResult { Success = false, Message = message };
|
||||
}
|
||||
|
||||
public class ServiceResult<T> : ServiceResult
|
||||
{
|
||||
public T? Data { get; private set; }
|
||||
|
||||
public static ServiceResult<T> Ok(T data) => new ServiceResult<T> { Success = true, Data = data };
|
||||
public new static ServiceResult<T> Failure(string message) => new ServiceResult<T> { Success = false, Message = message };
|
||||
}
|
||||
Reference in New Issue
Block a user