How to bind XML data in to VIEW

Posted by Self-Innovator under ASP.NET MVC on 4/18/2016 | Points: 10 | Views : 483 | Status : [Member] | Replies : 3
public ActionResult Manage()
{
return View("Index", GetStoreReports());
}
public LogisticsInfoViewModel GetStoreReports()
{

var generalReportAccess = new LogisticsInfoViewModel();

var storeProfileList = _storeProfileRepository.GetGeneralInfoReport();

XDocument xDoc=new XDocument();

var logisticsModel = from x in xDoc.Descendants("logistics")
select new LogisticsInfoViewModel
{
FreightRate = (string)x.Element("freightrate"),
OffShoreDelivery = (string)x.Element("offshoredelivery")
};
var p = logisticsModel;
return logiticsModel;
}

Return logisticsModel throws error

Join Hands Change lives
Thanks & Regards
Straight Edge Society



Responses

Posted by: Rajnilari2015 on: 4/18/2016 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 25

Up
0
Down
Bind the view model (:

B/t what is the error?

--
Thanks & Regards,
RNA Team

Self-Innovator, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Self-Innovator on: 4/18/2016 [Member] Bronze | Points: 25

Up
0
Down
Hi Raj,
It is not accepting the return type..could you sugest me some solution

Join Hands Change lives
Thanks & Regards
Straight Edge Society

Self-Innovator, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajnilari2015 on: 4/18/2016 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 25

Up
0
Down
It should ideally..if not use Cast<T>... but what is the exact error?

--
Thanks & Regards,
RNA Team

Self-Innovator, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response