using System; using System.Collections.Generic; using System.Text; namespace Bowin.Common.WebModels { public class ResultMessage : ResultMessage { public new T Data { get; set; } } public class ResultMessage { public bool IsSuccess { get; set; } public string Message { get; set; } public object Data { get; set; } public static ResultMessage Convert(ResultMessage error) { return new ResultMessage { IsSuccess = error.IsSuccess, Message = error.Message }; } public static ResultMessage GetError(string _message) { return new ResultMessage { IsSuccess = false, Message = _message }; } public static ResultMessage GetError(string _message) where T : class { return Convert(GetError(_message)); } public static ResultMessage GetError(string _message, object _data) { return new ResultMessage { IsSuccess = false, Message = _message, Data = _data }; } public static ResultMessage GetError(string _message, T _data) where T : class { return new ResultMessage { IsSuccess = false, Message = _message, Data = _data }; } public static ResultMessage Success() { return new ResultMessage { IsSuccess = true, Message = "" }; } public static ResultMessage Success(object _data) { return new ResultMessage { IsSuccess = true, Message = "", Data = _data }; } public static ResultMessage Success() where T : class { return Convert(Success()); } public static ResultMessage Success(T _data) where T : class { return new ResultMessage { IsSuccess = true, Message = "", Data = _data }; } } }