Esempio n. 1
0
 protected SelectList ClassSelect()
 {
     var catvalues = Enum.GetValues(typeof(PlanetCategory));
     ICategoryClassRepo ccr = new CategoryClassRepo();
     List<PlanetClass> pcList = ccr.GetPlanetClassesByCategory((int)catvalues.GetValue(0));
     Dictionary<int, string> pcDictionary = pcList.ToDictionary(pc => (int)pc, pc => pc.GetDescription());
     return new SelectList(pcDictionary, "Key", "Value");
 }
Esempio n. 2
0
 public ActionResult GetPlanetClassesByCategory(int categoryId)
 {
     ICategoryClassRepo ccr = new CategoryClassRepo();
     List<PlanetClass> pcList = ccr.GetPlanetClassesByCategory(categoryId);
     Dictionary<int, string> displayList = pcList.ToDictionary(pc => (int) pc, pc => pc.GetDescription());
     SelectList selectList = new SelectList(displayList, "Key", "Value");
     return Json(selectList, JsonRequestBehavior.AllowGet);
 }