dear all,
this is my class
public class Document
{
public int id { get; set; }
public int categoryId { get; set; }
public string referenceNumber { get; set; }
public int referenceSequence { get; set; }
public int sendingEntityId { get; set; }
public int statusId { get; set; }
public int priorityId { get; set; }
public int privacyId { get; set; }
public int privacyLevel { get; set; }
public string subject { get; set; }
public int documentTypeId { get; set; }
public DateTime dueDate { get; set; }
public int attachmentId { get; set; }
public DateTime createdDate { get; set; }
public DateTime modifiedDate { get; set; }
public int createdByUserId { get; set; }
public int createdByStructureId { get; set; }
public bool isLocked { get; set; }
public List<Transfer> transfers { get; set; }
public List<int> documentReceiverEntity { get; set; }
public Form form { get; set; }
public DateTime initialCreatedDate { get; set; }
public string ocrContent { get; set; }
public string body { get; set; }
public List<object> keyword { get; set; }
}
public class Form
{
public string OldStatus { get; set; }
public string OldDocTransferStatus { get; set; }
}
public class Transfer
{
public int id { get; set; }
public int documentId { get; set; }
public int statusId { get; set; }
public int fromStructureId { get; set; }
public int fromUserId { get; set; }
public int toStructureId { get; set; }
public int toUserId { get; set; }
public DateTime openedDate { get; set; }
public int ownerUserId { get; set; }
public DateTime closedDate { get; set; }
public DateTime dueDate { get; set; }
public DateTime createdDate { get; set; }
public int createdByUserId { get; set; }
public bool cced { get; set; }
public string instruction { get; set; }
public int? purposeId { get; set; }
public int? parentTransferId { get; set; }
}
I want to load the data from the datatable with model to post bulk data as json. I created the model class as below but for transfer list i'm unable to add
var doc = new Document()
{
id = 1223,
categoryId = model.categoryId,
referenceNumber = model.referenceNumber,
referenceSequence = model.referenceSequence,
sendingEntityId = model.sendingEntityId,
statusId = model.statusId,
priorityId = model.priorityId,
privacyId = model.privacyId,
privacyLevel = model.privacyLevel,
subject = model.subject,
documentTypeId = model.documentTypeId,
dueDate = model.dueDate,
attachmentId = model.attachmentId,
createdDate = model.createdDate,
modifiedDate = model.modifiedDate,
createdByUserId = model.createdByUserId,
createdByStructureId = model.createdByStructureId,
isLocked = model.isLocked
//adding transfers list
};
Sample Data:
{
"id": 1,
"categoryId": 1,
"referenceNumber": "1",
"referenceSequence": 1,
"sendingEntityId": 1,
"statusId": 1,
"priorityId": 1,
"privacyId": 1,
"privacyLevel": 1,
"subject": "subject",
"documentTypeId": 1,
"dueDate": "2017-08-02T00:00:00",
"attachmentId": 138814,
"createdDate": "2017-06-20T00:00:00",
"modifiedDate": "2023-11-07T21:52:05.7729550",
"createdByUserId": 1,
"createdByStructureId": 1,
"isLocked": false,
"transfers": [
{
"id": 1,
"documentId": 1,
"statusId": 1,
"fromStructureId": 1,
"fromUserId": 1,
"toStructureId": 1,
"toUserId": 1,
"openedDate": "2017-06-21T14:17:21.3433333",
"ownerUserId": 1,
"closedDate": "2017-06-21T15:14:18.4966667",
"dueDate": "2017-08-02T00:00:00",
"createdDate": "2017-06-21T14:17:21.3433333",
"createdByUserId": 1,
"cced": false,
"instruction": ""
},
{
"id": 2,
"documentId": 2,
"statusId": 2,
"purposeId": 2,
"fromStructureId": 2,
"fromUserId": 2,
"toStructureId": 2,
"toUserId": 2,
"openedDate": "2017-06-21T15:14:18.4500000",
"ownerUserId": 2,
"closedDate": "2017-06-21T19:26:15.5366667",
"dueDate": "2017-08-02T00:00:00",
"parentTransferId": 2,
"createdDate": "2017-06-21T15:14:18.4500000",
"createdByUserId": 2,
"cced": false,
"instruction": ""
}
],
"documentReceiverEntity": [
19554
],
"form": {
"OldStatus": "Completed",
"OldDocTransferStatus": "1"
},
"initialCreatedDate": "2017-06-21T14:15:45.6900000",
"ocrContent": "",
"body": "",
"keyword": []
}
I want to send the data as sample data from the datatable.
Thank you very much