/// <summary> /// Taggeds the specified id. /// </summary> /// <param name="tag">The tag.</param> /// <returns></returns> public ActionResult Index(string tag) { Tag completeTag = _tagRepository.RetrieveTagByNameAndUserId(tag, Owner.Id); string viewName = GetViewName(tag); IDictionary <string, string> breadCrumbs = GetBreadCrumbs(); breadCrumbs.Add(viewName, UrlService.UserUrl("tagged/" + HttpUtility.HtmlEncode(tag))); TagsIndexView view = ModelFactory <TagsIndexView>(new { Name = viewName, Tag = new Tag(tag) }); if (completeTag != null) { List <Tag> relatedTags = _tagRepository.GetRelatedTags(completeTag.Id); List <Media> photos = _mediaRepository.RetrieveByTagNameAndUserId(tag, Owner.Id); string url = string.Format("{0}/tagged/{1}", Authorization.Owner.Username, tag); _persistentCollectionService.SetBackUrl(url, SiteCookie); string key = _persistentCollectionService.Set(Authorization.Owner.Username + "_tagged_" + tag, photos, Persistence.Permanent); view.Set = key; view.Media = photos; view.Tag = completeTag; view.RelatedTags = _tagService.HyperlinkTheTags(relatedTags, Owner.Username); } return(View(view, breadCrumbs)); }
/// <summary> /// Displays this instance. /// </summary> /// <returns></returns> public ActionResult Display(string id) { List <Media> media = _mediaRepository.RetrieveByTagNameAndUserId(id, Owner.Id); string tagName = GetViewName(id); IDictionary <string, string> crumbs = GetBreadCrumbs(); crumbs.Add(tagName, UrlService.UserUrl("tags/display/" + HttpUtility.HtmlEncode(id))); TagsIndexView displayView = ModelFactory <TagsIndexView>(new { Media = media, Name = HttpUtility.HtmlEncode(tagName), }); return(View("Index", displayView, crumbs)); }