public JsonResult GetNavsList(string cpcode) { List <Plays> model = WebSetBusiness.GetLotteryPlaysesByCode(cpcode); model.ForEach(x => { if (x.Layer == 2) { List <Plays> templay = model.Where(y => y.PIDS == (x.PIDS + "_" + y.PCode) && y.Layer == 3).ToList(); x.ChildPlays = templay; } }); model.ForEach(x => { if (x.Layer == 1) { List <Plays> templay = model.Where(y => y.PIDS == (x.PIDS + "_" + y.PCode) && y.Layer == 2).ToList(); x.ChildPlays = templay; } }); JsonDictionary.Add("items", model.Where(x => x.Layer == 1).ToList()); return(new JsonResult() { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult LotteryPlays(string cpCode, string cpName) { ViewBag.Model = WebSetBusiness.GetLotteryPlaysesByCode(cpCode); var plays = WebSetBusiness.GetPlays(); ViewBag.CPName = cpName; ViewBag.CPCode = cpCode; ViewBag.Menus = plays.Where(x => x.Layer == 1).ToList(); ViewBag.CMenus = plays.Where(x => x.Layer == 2).ToList(); ViewBag.TMenus = plays.Where(x => x.Layer == 3).ToList(); return(View()); }