public override ViewIdentifierAndModel HandleVisualizationRequest() { var model = new EarthSpheresImageGalleryViewModel(); foreach (var submission in GetAllSubmissionsForCourseRun()) { var img1 = new GeoImage() { ImageUrl = submission.Sphere1Url, Coordinate = new Coordinate(submission.Sphere1Coordinate.Latitude, submission.Sphere1Coordinate.Longitude) }; var img2 = new GeoImage() { ImageUrl = submission.Sphere2Url, Coordinate = new Coordinate(submission.Sphere2Coordinate.Latitude, submission.Sphere2Coordinate.Longitude) }; AddSphereImageToModel(model, img1, submission.Sphere1Name); AddSphereImageToModel(model, img2, submission.Sphere2Name); } return new ViewIdentifierAndModel("~/Views/EarthSpheresImageGalleryView.cshtml", model); }
private void AddSphereImageToModel(EarthSpheresImageGalleryViewModel model, GeoImage img, string sphereName) { if (sphereName == "geosphere") { model.GeosphereImages.Add(img); } else if (sphereName == "atmosphere") { model.AtmosphereImages.Add(img); } else if (sphereName == "biosphere") { model.BiosphereImages.Add(img); } else if (sphereName == "hydrosphere") { model.HydrosphereImages.Add(img); } else if (sphereName == "cryosphere") { model.CryosphereImages.Add(img); } }