1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
-
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using MBIRevitBase.Result;
- namespace MBIRevitBase
- {
-
-
-
- public class BResult
- {
- public BResult(bool isSuccessed)
- {
- IsSuccessed = isSuccessed;
- }
- public BResult(bool isSuccessed, string message) : this(isSuccessed)
- {
- Message = message;
- }
- public bool IsSuccessed { get; private set; }
- public string Id { get; set; }
- public string Message { get; set; }
-
-
-
- public object Tag { get; set; }
- public static implicit operator bool(BResult result)
- {
- return result.IsSuccessed;
- }
- public static implicit operator BResult(bool d)
- {
- return new BResult(d);
- }
- public static implicit operator BResult(string errorMessage)
- {
-
- return new BResult(false, errorMessage);
- }
- public static implicit operator BResult(HttpResult result)
- {
-
- var rr = new BResult(true);
- if(result!=null)
- rr=new BResult(result.Result=="success",result.Message);
- return rr;
- }
- public override string ToString()
- {
- return Message ?? string.Empty;
- }
- }
- }
|