namespace ProductionLineMonitor.Application.Services { public enum CodeEnum { Success, Fail, Error } public class Result { public Result() { } public Result(CodeEnum code, string message) { Code = code; Message = message; } public CodeEnum Code { get; set; } public string Message { get; set; } public static Result Success() { return new Result(CodeEnum.Success, "Ok!"); } public static Result Fail(string message) { return new Result(CodeEnum.Fail, message); } public static Result Error(string error) { return new Result(CodeEnum.Error, error); } } public class Result : Result { public Result() : base() { } public Result(CodeEnum code, string message) : base(code, message) { } public Result(CodeEnum code, string message, T data) : base(code, message) { Data = data; } public T Data { get; set; } public static new Result Success() { return new Result(CodeEnum.Success, "Ok!"); } public static Result Success(T data) { return new Result(CodeEnum.Success, "Ok!", data); } public static new Result Fail(string message) { return new Result(CodeEnum.Fail, message); } public static new Result Error(string message) { return new Result(CodeEnum.Error, message); } } }