Exemplo n.º 1
0
        // GET: All
        public ActionResult All()
        {
            IStarSystemRepo ssr = new StarSystemRepo();
            List<StarSystemViewModel> starSystems = ssr.GetAll().ToList();

            var json = Json(starSystems);
            json.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            return json;
        }
Exemplo n.º 2
0
 protected SelectList SystemSelect()
 {
     IStarSystemRepo ssr = new StarSystemRepo();
     Dictionary<int, string> ssList = ssr.GetAll().ToDictionary(ss => ss.Id, ss => ss.Name);
     return new SelectList(ssList, "Key", "Value");
 }
Exemplo n.º 3
0
 // GET: Planet
 public ActionResult Index()
 {
     IPlanetRepo pr = new PlanetRepo();
     IStarSystemRepo ssr = new StarSystemRepo();
     var planets = pr.GetAll().ToList();
     var starSystems = ssr.GetAll().ToList();
     foreach (var planet in planets)
     {
         planet.StarSystem = starSystems.Single(ss => ss.Id == planet.StarSystem.Id);
     }
     return View(planets);
 }
Exemplo n.º 4
0
 // GET: StarSystem
 public ActionResult Index()
 {
     IStarSystemRepo ssr = new StarSystemRepo();
     var starSystems = ssr.GetAll().ToList();
     return View(starSystems);
 }