Home > Net >  Sending 2 Lists In A Class From Postman
Sending 2 Lists In A Class From Postman

Time:01-12

these are my classes.

 public class BasketClass
        {
            public int HowMany { get; set; }
            public int MBasketId { get; set; }
            public int MVendorId { get; set; }
            public int WInvestorId { get; set; }
            public int MProductId { get; set; }
        }

        public class VendorPay
        {
            public int id { get; set; }
            public int MVendorId { get; set; }
            public bool IsCargoIncluded { get; set; }
            public decimal CargoAmount { get; set; }
            public decimal TotalAmount { get; set; }
        }

        public class PayBasketInputClass
        {
            public List<BasketClass> mOrderList { get; set; }
            public List<VendorPay> vendorPayList { get; set; }

        }

And this is my method.


public IActionResult PayBasket(int WInvestorId, PayBasketInputClass payInput, string paymenttype)

I gotta send payInput from body. But it includes two lists and its to complicated for me. Can you help me how to do it with an example?

Cheers.

CodePudding user response:

{
    "mOrderList": [
        {
            "HowMany": 1,
            "MBasketId": 2,
            "MVendorId": 3,
            "WInvestorId": 4,
            "MProductId": 5
        }
    ],
    "vendorPayList": [
        {
            "id": 1,
            "MVendorId": 2,
            "IsCargoIncluded": true,
            "CargoAmount": 3.99,
            "TotalAmount": 4.99
        }
    ]
}

Json object is above is your PayBasketInputClass object in json structure.

  • Related