1. C# Post Code
[HttpPost]
[Route("data")]
//public async Task<(int st, string msg, Receipt data)> PostReceipt([FromBody] Receipt receipt, [FromBody] List<Receipt_Det_bill> rec_det_list)
public async Task<(int st, string msg, Receipt data)> PostReceipt([FromBody] ReceiptWithDet receiptWithDet)
{
Receipt receipt = receiptWithDet.receipt;
List<Receipt_Det_bill> rec_det_list = receiptWithDet.receiptDet;
return (200, db.msg_success, receipt);
}
2. C# Class Code
public partial class ReceiptWithDet
{
public Receipt receipt;
public List<Receipt_Det_bill> receiptDet;
}
public partial class Receipt
{
[Key]
public int Srno { get; set; }
public string Rec_Code { get; set; }
public string U_id { get; set; }
}
public partial class Receipt_Det_bill
{
public string Rec_Code { get; set; }
public string Sale_No { get; set; }
public Nullable<DateTime> Odr_Date { get; set; }
public Nullable<decimal> Net_Amount { get; set; }
public Nullable<bool> ok { get; set; }
}
3. JSON Post
http://localhost:52776/api/receipt/data POST
{
receipt:{
Acc_No: null,
Amt: 50,
Pay_Mode: "CASH",
Pcode: "CU7",
Rec_Date: "2021-11-23",
Rec_No: null,
Remark: "ss",
},
receiptDet:[{
Rec_Code:"22",
Sale_Code:"11"
}]
}