I have updated the code as below
public ActionResult GetLogisticsReport(int StoreId)
{
StoreId = 00316;
try
{
XmlDocument xmlDoc = new XmlDocument();
string LogisticsReportResponseXml = _reportService.GetLogisticsReportInfo(StoreId).Result;
xmlDoc.LoadXml(LogisticsReportResponseXml);
var logisticsInfoViewModel = new LogisticsInfoViewModel();
XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlDoc.NameTable);
nsmgr.AddNamespace("ns", "http://wsdev.truserv.com/oraclewebservice/oraclemdb.asmx");
XmlNode resultNode = xmlDoc.SelectSingleNode("results", nsmgr);
XmlNode userNode = resultNode.SelectSingleNode("logistics/freight", nsmgr);
if (userNode != null)
{
logisticsInfoViewModel.FreightRate = userNode.Attributes["freightrate"] != null ? userNode.Attributes["freightrate"].Value : string.Empty;
logisticsInfoViewModel.OffShoreDelivery = userNode.Attributes["offshoredelivery"] != null ? userNode.Attributes["offshoredelivery"].Value : string.Empty;
logisticsInfoViewModel.StartCode = userNode.Attributes["stratcode"] != null ? userNode.Attributes["stratcode"].Value : string.Empty;
logisticsInfoViewModel.MultiDelivery = userNode.Attributes["multipledelivery"] != null ? userNode.Attributes["multipledelivery"].Value : string.Empty;
logisticsInfoViewModel.Palletized = userNode.Attributes["palletized"] != null ? userNode.Attributes["palletized"].Value : string.Empty;
logisticsInfoViewModel.TotesShipped = userNode.Attributes["totesshipped"] != null ? userNode.Attributes["totesshipped"].Value : string.Empty;
logisticsInfoViewModel.TotesReturned = userNode.Attributes["totesreturned"] != null ? userNode.Attributes["totesreturned"].Value : string.Empty;
logisticsInfoViewModel.TotesLastDate = userNode.Attributes["toteslastdate"] != null ? userNode.Attributes["toteslastdate"].Value : string.Empty;
logisticsInfoViewModel.ContainersShipped = userNode.Attributes["containersshipped"] != null ? userNode.Attributes["containersshipped"].Value : string.Empty;
logisticsInfoViewModel.ContainersReturned = userNode.Attributes["containersreturned"] != null ? userNode.Attributes["containersreturned"].Value : string.Empty;
logisticsInfoViewModel.ContainersLastDate = userNode.Attributes["containerslastdate"] != null ? userNode.Attributes["containerslastdate"].Value : string.Empty;
XmlNode routeNode = resultNode.SelectSingleNode("logistics/routes/route", nsmgr);
if(routeNode!=null)
{
logisticsInfoViewModel.DayOfTheWeek = routeNode.Attributes["dayofweek"] != null ? routeNode.Attributes["dayofweek"].Value : string.Empty;
logisticsInfoViewModel.GroupNo = routeNode.Attributes["groupnbr"] != null ? routeNode.Attributes["groupnbr"].Value : string.Empty;
logisticsInfoViewModel.TruckRouteId = routeNode.Attributes["truckrouteid"] != null ? routeNode.Attributes["truckrouteid"].Value : string.Empty;
logisticsInfoViewModel.OrderPickRequest = routeNode.Attributes["orderpickseq"] != null ? routeNode.Attributes["orderpickseq"].Value : string.Empty;
logisticsInfoViewModel.TruckLoadSeq = routeNode.Attributes["truckloadseq"] != null ? routeNode.Attributes["truckloadseq"].Value : string.Empty;
logisticsInfoViewModel.TruckLoadSeq2 = routeNode.Attributes["truckloadseq2"] != null ? routeNode.Attributes["truckloadseq2"].Value : string.Empty;
logisticsInfoViewModel.Shift = routeNode.Attributes["shift"] != null ? routeNode.Attributes["shift"].Value : string.Empty;
}
}
return PartialView("_logisticsReport", logisticsInfoViewModel);
}
My XML Output
<results>
<response mode="all" value=""/>
<logistics>
<freight rdc1="01 - HARVARD" rdc2="01 - HARVARD" freightrate="5.31 %" offshoredelivery="N" stratcode="J" multipledelivery="N" palletized="Y" totesshipped="17875" totesreturned="17891" toteslastdate="11/28/2015 12:00:00 AM" containersshipped="0" containersreturned="0" containerslastdate="11/28/2015 12:00:00 AM" />
<routes>
<route dayofweek="Sunday" groupnbr="8" truckrouteid="AF" truckloadseq="23" orderpickseq="C " truckloadseq2="#" shift="1" />
</routes>
</logistics>
</results>
<div class="col-md-12">
<h3>Select Report</h3>
@Html.DropDownList("bindReports", new List<SelectListItem>()
{
new SelectListItem() { Text= "Consolidated Purchases", Value = "cp" },
new SelectListItem() { Text= "General Information", Value = "gi" },
new SelectListItem() { Text= "Logistics", Value = "lg" },
new SelectListItem() { Text= "Programs", Value = "pr" }
}, "Select Report")
<a href="#" class="red-btn">Print Report</a>
</div>
<div id="_genericReport">
</div>
<div class="general-info">
</div>
Java script function
$("#bindReports").change(function () {
var webUrl;
var dropval = $("#bindReports").val();
if (dropval == "Select Report") {
alert("Pls select")
}
else {
if (dropval == "lg") {
webUrl = "GetLogisticsReport"
}
if (dropval == "pr") {
webUrl = "GetProgramsReport"
}
$.ajax(
{
type: 'GET',
data: { 'StoreId': '00316' },
datatype: "json",
url: webUrl,
success: function (data) {
var json = data;
console.log(json);
$('#_genericReport').html('');
$('#_genericReport').html(data);
},
error: function (result) {
alert('Failed to load the result');
}
})
}
});