The problem is this: I want to run 3 different actions, but instead I want to transfer all the data from one action to a larger model.
I use:
public class SearchScrapClass { public WClass WClass { get; set; } public SClass SClass { get; set; } public YClass YClass { get; set; } } public class WClass { public string title { get; set; } public string link { get; set; } } public class SClass { public string title { get; set; } public string link { get; set; } } public class YClass { public string title { get; set; } public string link { get; set; } }
I use LINQ to add data to these models.
I use:
var wikians = from info in document.DocumentNode.SelectNodes("//div[@id='span']") from link in info.SelectNodes("div//a").Where(x => x.Attributes.Contains("href")) select new SearchScrapClass //Main Bigger Class { WClass.link= link.Attributes["href"].Value, //ERROR: How to add to WClass url ? WClass.title= link.InnerText //ERROR: How to add to WClass url ? } var wikians = from info in document.DocumentNode.SelectNodes("//div[@id='results']") from link in info.SelectNodes("p//a").Where(x => x.Attributes.Contains("href")) select new SearchScrapClass //Main Bigger Class { YClass.link= link.Attributes["href"].Value, //ERROR: How to add to YClass url ? YClass.title= link.InnerText //ERROR: How to add to YClass url ? } //Also for the 3rd class (model) return View(wikians); //and then return bigger class model so that i can access them in view
This is one way to add data to the link and title of all classes.
My attempt is to add data to all 3 classes from different sources and pass a large model for viewing so that I can access all classes as follows:
@model SearchScrapClass @using(Html.BeginForm()) { @Html.EditorFor(o => o.WClass.link) ... }
Please suggest a way
thanks
Man8blue
source share