public string TransferBatch(HttpRequestMessage req) { var postedString = req.Content.ReadAsStringAsync().Result; dynamic v = JArray.Parse(postedString); //dynamic d = JObject.Parse(Convert.ToString(postedString)); //string month = Convert.ToDateTime(d.month); JArray toCsv = new JArray(); JArray pushJob = new JArray(); foreach (var equipment in v) { JObject item = new JObject(); JObject itemPushJob = new JObject(); string indate = equipment.jobDate; string[] dateinarray = indate.Split(' '); // for pushing into Transit Database itemPushJob.Add(new JProperty("SerialNo", equipment.SerialNo)); itemPushJob.Add(new JProperty("EquipmentID", Convert.ToString(equipment.Equipment))); itemPushJob.Add(new JProperty("EquipmentDescription", Convert.ToString(equipment.EquipmentDescription))); if (equipment.ToJob == "") { itemPushJob.Add(new JProperty("TransferLocID", equipment.ToLocation)); } else if (equipment.ToLocation == "") { itemPushJob.Add(new JProperty("TransferLocID", equipment.ToJob)); } itemPushJob.Add(new JProperty("TransferLocName", equipment.TransferLocDescription)); itemPushJob.Add(new JProperty("jobDate", equipment.jobDate)); itemPushJob.Add(new JProperty("CreatedBY", equipment.CreatedBy)); itemPushJob.Add(new JProperty("CreatedTime", DateTime.Now.ToString())); itemPushJob.Add(new JProperty("PhysicalDate", DateTime.Now.ToShortDateString())); pushJob.Add(itemPushJob); } obj = new DSL(); try { //string updateStatus= obj.UpdatevEMLocationHistory(JArray.Parse(postedString)); string updateStatus = obj.UpdatevEMLocationHistoryV2(JArray.Parse(postedString)); if (updateStatus == "1") { int TransitDBUpdate = obj.SchdeuleJob(pushJob); if (TransitDBUpdate == 1) { int phyisycalDateUpdate = obj.updateEquipmentPhysicaDateViewpoint(pushJob); if (phyisycalDateUpdate == 1) { return("Success"); } else { return("Date_update_failed"); } } else { return("failed"); } } else if (updateStatus == "-1") { return("failed"); } else { //return faulty equipment status in batch return(updateStatus); } } catch (Exception ex) { return("failed"); } }