public class TopLevelViewModel
{
public TopLevelID { get; set; }
public TopLevelTitle { get; set; }
public List<SecondLevelViewModel> SeconLevel { set; get; }
public TopLevelViewModel()
{
Inner = new List<SecondLevelViewModel>();
}
}
public class SecondLevelViewModel
{
public SecondLevelID { get; set; }
public SecondLevelTitle { get; set; }
public TopLevelID { get; set; }
public WrapperViewModel { get; set; }
}
public class InnerViewModel
{
public InnerID { get; set; }
public InnerTitle { get; set; }
public SecondLevelID { get; set; }
}
public class WrapperViewModel
{
public List<InnerViewModel> Inner { set; get; }
public WrapperViewModel()
{
Inner = new List<InnerViewModel>();
}
}
List<TopLevelViewModel> data = null ;
data = db.TopLevel.Where(t => t.TopLevelID == URLTopLevelID).Select(t => new TopLevelViewModel()
{
TopLevelID = t.TopLevelID,
TopLevelTitle = t.TopLevelTitle,
SeconLevel = db.SecondLevel.Where(s => s.TopLevelID == t.TopLevelID).Select(s => new SecondLevelViewModel()
{
SecondLevelID = s.SecondLevelID,
SeconLevelTitle = s.SeconLevelTitle,
WrapperViewModel = ??????question???????
}).ToList<SecondLevelViewModel>()
}).ToList < TopLevelViewModel();
db.Inner.Where(i => i.SecondLevelID == s.SecondLevelID).Select(i => new InnerViewModel()
{
InnerID = i.InnerID,
InnerTitle = i.InnerTitle
}).ToList<InnerViewModel>()
List<TopLevelViewModel> data = null ;
data = db.TopLevel.Where(t => t.TopLevelID == URLTopLevelID).Select(t => new TopLevelViewModel()
{
TopLevelID = t.TopLevelID,
TopLevelTitle = t.TopLevelTitle,
SeconLevel = db.SecondLevel.Where(s => s.TopLevelID == t.TopLevelID).Select(s => new SecondLevelViewModel()
{
SecondLevelID = s.SecondLevelID,
SeconLevelTitle = s.SeconLevelTitle,
WrapperViewModel = new WrapperViewModel { Inner =
db.Inner.Where(i => i.SecondLevelID == s.SecondLevelID).Select(i => new InnerViewModel()
{
InnerID = i.InnerID,
InnerTitle = i.InnerTitle
}).ToList<InnerViewModel>()
}).ToList<SecondLevelViewModel>()
}).ToList < TopLevelViewModel();
{
public TopLevelID { get; set; }
public TopLevelTitle { get; set; }
public List<SecondLevelViewModel> SeconLevel { set; get; }
public TopLevelViewModel()
{
Inner = new List<SecondLevelViewModel>();
}
}
public class SecondLevelViewModel
{
public SecondLevelID { get; set; }
public SecondLevelTitle { get; set; }
public TopLevelID { get; set; }
public WrapperViewModel { get; set; }
}
public class InnerViewModel
{
public InnerID { get; set; }
public InnerTitle { get; set; }
public SecondLevelID { get; set; }
}
public class WrapperViewModel
{
public List<InnerViewModel> Inner { set; get; }
public WrapperViewModel()
{
Inner = new List<InnerViewModel>();
}
}
List<TopLevelViewModel> data = null ;
data = db.TopLevel.Where(t => t.TopLevelID == URLTopLevelID).Select(t => new TopLevelViewModel()
{
TopLevelID = t.TopLevelID,
TopLevelTitle = t.TopLevelTitle,
SeconLevel = db.SecondLevel.Where(s => s.TopLevelID == t.TopLevelID).Select(s => new SecondLevelViewModel()
{
SecondLevelID = s.SecondLevelID,
SeconLevelTitle = s.SeconLevelTitle,
WrapperViewModel = ??????question???????
}).ToList<SecondLevelViewModel>()
}).ToList < TopLevelViewModel();
db.Inner.Where(i => i.SecondLevelID == s.SecondLevelID).Select(i => new InnerViewModel()
{
InnerID = i.InnerID,
InnerTitle = i.InnerTitle
}).ToList<InnerViewModel>()
List<TopLevelViewModel> data = null ;
data = db.TopLevel.Where(t => t.TopLevelID == URLTopLevelID).Select(t => new TopLevelViewModel()
{
TopLevelID = t.TopLevelID,
TopLevelTitle = t.TopLevelTitle,
SeconLevel = db.SecondLevel.Where(s => s.TopLevelID == t.TopLevelID).Select(s => new SecondLevelViewModel()
{
SecondLevelID = s.SecondLevelID,
SeconLevelTitle = s.SeconLevelTitle,
WrapperViewModel = new WrapperViewModel { Inner =
db.Inner.Where(i => i.SecondLevelID == s.SecondLevelID).Select(i => new InnerViewModel()
{
InnerID = i.InnerID,
InnerTitle = i.InnerTitle
}).ToList<InnerViewModel>()
}).ToList<SecondLevelViewModel>()
}).ToList < TopLevelViewModel();