i have two different dropdown lists and each have a select statement to return proper information. Running into a few issues:
what format should i properly return the results from select statement as?
do i control the select statement of the second dropdown list based on the id from the selected item in the first dropdown list.
Service layer: 1st dropdown list
public IEnumerable<ContentVw> GetSections()
{
using (var db = my connection info)
{
var sections = (from e in db.Table1
join re in db.RootTables re
on e.ID equals re.Table1ID
where re.ChairID == 1
select new { e.DisplayName, e.ID, e.GUID };
return sections;
}
}
error: cannot convert IQueryable anonymous to ...ContentVw
2nd dropdownList
public IEnumerable<ContentVw> GetContent(int itemId) //itemId = first dropdown list selection
{
using (var db = my connection info)
{
var content = (from e in db.Table1 join em in db.TableToTableMaps on e.ID equals em.KnowsTableID where em.TableID == itemId select new { e.DisplayName, e.ID, e.GUID });
}
}
ContentVw:
public partial class ContentVw
{
public string Name { get; set; }
public int Id { get; set; }
public Guid GUID { get; set; }
}
Controller
public ActionResult ContentManage()
{
var _sections = new ContentService().GetSections().ToList();
ViewBag.SectionsDropdown = _sections;
return View();
}