Hi
I have below object . How i can assign values and then serialize using restsharp
public class BuyerDtls
{
public string Gstin { get; set; }
public string LglNm { get; set; }
public string Pos { get; set; }
public string Addr1 { get; set; }
public string Loc { get; set; }
public int Pin { get; set; }
public string Stcd { get; set; }
}
public class DispDtls
{
public string Nm { get; set; }
public string Addr1 { get; set; }
public string Loc { get; set; }
public int Pin { get; set; }
public string Stcd { get; set; }
}
public class DocDtls
{
public string Typ { get; set; }
public string No { get; set; }
public string Dt { get; set; }
}
public class ItemList
{
public int ItemNo { get; set; }
public string SlNo { get; set; }
public string IsServc { get; set; }
public string PrdDesc { get; set; }
public string HsnCd { get; set; }
public int Qty { get; set; }
public int FreeQty { get; set; }
public string Unit { get; set; }
public int UnitPrice { get; set; }
public int TotAmt { get; set; }
public int Discount { get; set; }
public int PreTaxVal { get; set; }
public int AssAmt { get; set; }
public int GstRt { get; set; }
public int IgstAmt { get; set; }
public int CgstAmt { get; set; }
public int SgstAmt { get; set; }
public int CesRt { get; set; }
public int CesAmt { get; set; }
public int CesNonAdvlAmt { get; set; }
public int StateCesRt { get; set; }
public int StateCesAmt { get; set; }
public int StateCesNonAdvlAmt { get; set; }
public int OthChrg { get; set; }
public int TotItemVal { get; set; }
}
public class Root
{
public string Version { get; set; }
public TranDtls TranDtls { get; set; }
public DocDtls DocDtls { get; set; }
public SellerDtls SellerDtls { get; set; }
public BuyerDtls BuyerDtls { get; set; }
public DispDtls DispDtls { get; set; }
public ShipDtls ShipDtls { get; set; }
public List ItemList { get; set; }
public ValDtls ValDtls { get; set; }
}
public class SellerDtls
{
public string Gstin { get; set; }
public string LglNm { get; set; }
public string Addr1 { get; set; }
public string Loc { get; set; }
public int Pin { get; set; }
public string Stcd { get; set; }
}
public class ShipDtls
{
public string Gstin { get; set; }
public string LglNm { get; set; }
public string Addr1 { get; set; }
public string Loc { get; set; }
public int Pin { get; set; }
public string Stcd { get; set; }
}
public class TranDtls
{
public string TaxSch { get; set; }
public string SupTyp { get; set; }
public string RegRev { get; set; }
public string IgstOnIntra { get; set; }
}
public class ValDtls
{
public int AssVal { get; set; }
public int CgstVal { get; set; }
public int SgstVal { get; set; }
public int IgstVal { get; set; }
public int CesVal { get; set; }
public int StCesVal { get; set; }
public int Discount { get; set; }
public int OthChrg { get; set; }
public int RndOffAmt { get; set; }
public int TotInvVal { get; set; }
}
Thanks
Jaimin ShethiyaPosted Aug 14, 2024, 10:36 AM
Hello Ramco,
In case the above mention object details are coming from the database, then you need to create the store procedure and assign that value or you can use the linq query as well.
Thanks
Naimish MakwanaPosted Aug 14, 2024, 4:41 AM
Here’s how you can assign values to your objects and then serialize them using RestSharp:
Please replace
"http://example.com"with your actual API endpoint. Also, make sure to assign appropriate values to all the properties of your objects. This is just a basic example. You may need to adjust it according to your specific requirements.Thanks