public ActionResult GetLaws() { var laws = db.Laws.Where(l => l.LawId != 0).ToList(); LawsViewModel lawsViewModel = new LawsViewModel { Laws = laws }; return View(lawsViewModel); }
public ActionResult GetSections(LawsViewModel lawsViewModel) { var sections = _db.Sections.Where(s => s.LawId == lawsViewModel.SelectedLaw).ToList(); string lawName = _db.Laws.Where(l => l.LawId == lawsViewModel.SelectedLaw).Select(l => l.LawTitle).SingleOrDefault(); ViewBag.LawName = lawName; SectionsViewModel sectionsViewModel = new SectionsViewModel() { Sections = sections,SelectedLawId=lawsViewModel.SelectedLaw }; return View(sectionsViewModel); }