WebClient client = new WebClient(); client.BaseAddress = "http://test.com"; var url = "/api/Customers/add"; client.Headers["Content-type"] = "application/json"; string StoreName = ConfigurationManager.AppSettings["StoreName"]; List<Customersinfo> bills = new List<Customersinfo>(); foreach (DataRow dr in dt.Rows) { Customersinfo Bill = new Customersinfo(); Bill.Storename = StoreName; bills.Add(Bill); } string data = JsonConvert.SerializeObject(bills); var response = client.UploadString(url, data); var result = JsonConvert.DeserializeObject<Customersinfo>(response);
[HttpPost] [Route("add")] public async Task<ObjectResult> AddCustomer([FromBody] List<Customersinfo> custinfo) { try { if (custinfo.Count > 0) { //Here I am not getting the data to insert into the database } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)