Exemplo n.º 1
0
        // GET: StarSystem/Details/5
        public ActionResult Details(int id)
        {
            IStarSystemRepo ssr = new StarSystemRepo();
            IPlanetRepo pr = new PlanetRepo();
            DetailsViewModel dvm = new DetailsViewModel();

            var planets = pr.GetByStarSystemId(id).ToList();
            var starSystem = ssr.GetById(id);
            dvm.StarSystem = starSystem;
            dvm.Planets = planets;
            return View(dvm);
        }
Exemplo n.º 2
0
 // GET: Planet/Details/5
 public ActionResult Details(int id)
 {
     IPlanetRepo pr = new PlanetRepo();
     IStarSystemRepo ssr = new StarSystemRepo();
     IFileSystemRepo fsr = new FileSystemRepo();
     var planet = pr.GetById(id);
     planet.StarSystem = ssr.GetById(planet.StarSystem.Id);
     planet.PlanetImagePaths = new Dictionary<string, string>();
     foreach (var item in fsr.GetFileDataByPlanetId(id))
     {
         planet.PlanetImagePaths.Add(item.Path.Replace("\\", "/"), item.Name);
     }
     return View(planet);
 }
Exemplo n.º 3
0
        public ActionResult Edit(int id)
        {
            IStarSystemRepo ssr = new StarSystemRepo();
            IPlanetRepo pr = new PlanetRepo();
            DetailsViewModel dvm = new DetailsViewModel();

            var planets = pr.GetByStarSystemId(id).ToList();
            var starSystem = ssr.GetById(id);
            dvm.StarSystem = starSystem;
            dvm.Planets = planets;
            var user = User.Identity;
            if (starSystem.Uploader == user.Name)
            {
                return View("Edit", starSystem);
            }
            return View("Details", dvm);
        }