You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.2 KiB
C#

using HcUtility.Comm;
using System.Web.Mvc;
namespace DSWeb.MvcShipping.Helper
{
public class JsonResponse
{
public bool Success {get;set;}
public string Message {get;set;}
public object Data {get;set;}
public object DataBody { get; set; }
public string Name { get; set; }
public ContentResult getContentReult()
{
ContentResult result = new ContentResult() { Content = JsonConvert.Serialize(this) };
return result;
}
public ContentResult getContentReult_success()
{
var json = JsonConvert.Serialize(new
{
success = this.Success,
Message = this.Message
});
return new ContentResult() { Content = json };
}
public JsonResponse()
{
}
public JsonResponse(DBResult result)
{
Success = result.Success;
Message = result.Message;
Data = result.Data;
}
public void ErrorMessage(string msg) {
Success = false;
if (!string.IsNullOrWhiteSpace(Message)) Message += ";";
Message += msg;
}
}
}