public ActionResult UsersSubmittedMedia(string id)
        {
            Guid userID = default(Guid);
            var  user   = default(Profile);

            if (Guid.TryParse(id, out userID))
            {
                user = usrSvc.GetProfileByID(userID);
            }
            else
            {
                user = usrSvc.GetProfileBySlugUrlPart(id);
            }
            if (user == default(Profile))
            {
                return(new ProfilesController().ProfileNotFound());
            }

            var medium      = mediaSvc.GetUsersMediaWithOpinions(user.ID).ToList();
            var pageHeading = string.Format("by <a href='{0}'>{1}</a>", user.SlugUrl, user.DisplayName);

            var model = new ViewerViewModel(user.ID, "user", user.DisplayName, user.SlugUrl, medium, pageHeading);

            model.ShowAddMedia = false;

            return(View("Viewer", model));
        }
        public ActionResult LatestCommunityMedia()
        {
            var model = new ViewerViewModel(Guid.Empty, "latest", "Most recently submitted", "/", mediaSvc.GetLatestMedia(60), "Most recently submitted");

            model.ShowAddMedia = false;

            return(View("Viewer", model));
        }
        public ActionResult Area(string countryUrlPart, string nameUrlPart)
        {
            var a = geoSvc.GetArea(country.ID, nameUrlPart);

            if (a == null)
            {
                return(PlaceNotFound());
            }

            var pageHeading = string.Format("of <a href='{0}'>{1}</a>", a.SlugUrl, a.Name);
            var model       = new ViewerViewModel(a.ID, "area", a.Name, a.SlugUrl, mediaSvc.GetObjectsMedia(a.ID), pageHeading);

            return(View("Viewer", model));
        }
        public ActionResult LocationIndoor(string countryUrlPart, string locationNameUrlPart)
        {
            var l = geoSvc.GetLocationIndoor(country.ID, locationNameUrlPart);

            if (l == null)
            {
                return(PlaceNotFound());
            }

            var pageHeading = string.Format("of <a href='{0}'>{1}</a>", l.SlugUrl, l.Name);
            var model       = new ViewerViewModel(l.ID, "indoor", l.Name, l.SlugUrl, mediaSvc.GetObjectsMedia(l.ID), pageHeading);

            return(View("Viewer", model));
        }
        public ActionResult Climb(string nameUrlPart, Guid id)
        {
            var c = geoSvc.GetClimbByID(id);

            if (c == default(Climb))
            {
                return(PlaceNotFound());
            }

            ViewBag.Country = AppLookups.Country(c.CountryID);
            var pageHeading = string.Format("of <a href='{0}'>{1}</a>", c.SlugUrl, c.Name);
            var model       = new ViewerViewModel(c.ID, "climb", c.Name, c.SlugUrl, mediaSvc.GetObjectsMedia(c.ID), pageHeading);

            return(View("Viewer", model));
        }
        public ActionResult UsersSubmittedMedia(string id)
        {
            Guid userID = default(Guid);
            var user = default(Profile);
            if (Guid.TryParse(id, out userID)) { user = usrSvc.GetProfileByID(userID); }
            else { user = usrSvc.GetProfileBySlugUrlPart(id); }
            if (user == default(Profile)) { return new ProfilesController().ProfileNotFound(); }

            var medium = mediaSvc.GetUsersMediaWithOpinions(user.ID).ToList();
            var pageHeading = string.Format("by <a href='{0}'>{1}</a>", user.SlugUrl, user.DisplayName);

            var model = new ViewerViewModel(user.ID, "user", user.DisplayName, user.SlugUrl, medium, pageHeading);
            model.ShowAddMedia = false;

            return View("Viewer", model);
        }
        public ActionResult LocationOutdoor(string countryUrlPart, string locationTypeUrlPart, string locationNameUrlPart)
        {
            var l = geoSvc.GetLocationOutdoor(country.ID, locationNameUrlPart);
            if (l == null) { return PlaceNotFound(); }
            ViewBag.Current = l;

            var pageHeading = string.Format("of <a href='{0}'>{1}</a>", l.SlugUrl, l.Name);
            var model = new ViewerViewModel(l.ID, "outdoor", l.Name, l.SlugUrl, mediaSvc.GetObjectsMedia(l.ID), pageHeading);

            return View("Viewer", model);
        }
        public ActionResult LatestCommunityMedia()
        {
            var model = new ViewerViewModel(Guid.Empty, "latest", "Most recently submitted", "/", mediaSvc.GetLatestMedia(60), "Most recently submitted");
            model.ShowAddMedia = false;

            return View("Viewer", model);
        }
        public ActionResult Climb(string nameUrlPart, Guid id)
        {
            var c = geoSvc.GetClimbByID(id);
            if (c == default(Climb)) { return PlaceNotFound(); }

            ViewBag.Country = AppLookups.Country(c.CountryID);
            var pageHeading = string.Format("of <a href='{0}'>{1}</a>", c.SlugUrl, c.Name);
            var model = new ViewerViewModel(c.ID, "climb", c.Name, c.SlugUrl, mediaSvc.GetObjectsMedia(c.ID), pageHeading);

            return View("Viewer", model);
        }
        public ActionResult Area(string countryUrlPart, string nameUrlPart)
        {
            var a = geoSvc.GetArea(country.ID, nameUrlPart);
            if (a == null) { return PlaceNotFound(); }

            var pageHeading = string.Format("of <a href='{0}'>{1}</a>", a.SlugUrl, a.Name);
            var model = new ViewerViewModel(a.ID, "area", a.Name, a.SlugUrl, mediaSvc.GetObjectsMedia(a.ID), pageHeading);

            return View("Viewer", model);
        }
Example #11
0
 public ImageViewer(ObservableCollection <ImageItem> items)
 {
     InitializeComponent();
     DataContext = new ViewerViewModel(items);
 }