using System; using Common; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace Common.Http { public abstract class CommonResponse { public string? requestId { get; set; } public string? errorCode { get; set; } public string? message { get; set; } public string? responseTime { get; set; } public string? totalRow { get; set; } public string? totalPage { get; set; } public string? pageNumber { get; set; } public string? pageSize { get; set; } public bool? status { get; set; } public void BuildCommonResponse(String data) { JObject jObject = JObject.Parse(data); if (jObject != null) { requestId = (string)jObject[nameof(requestId)]; responseTime = (string)jObject[nameof(responseTime)]; totalRow = (string)jObject[nameof(totalRow)]; totalPage = (string)jObject[nameof(totalPage)]; pageNumber = (string)jObject[nameof(pageNumber)]; pageSize = (string)jObject[nameof(pageSize)]; errorCode = (string)jObject[nameof(errorCode)]; message = (string)jObject[nameof(message)]; status = jObject[nameof(status)] != null ? (bool)jObject[nameof(status)]! : false; } } } }