/// <summary> /// Searches the specified text. /// </summary> /// <param name="text">The text.</param> /// <param name="cp">The cp.</param> /// <returns></returns> public ActionResult Search(string text, string cp) { List <Media> media = (!string.IsNullOrEmpty(text) ? _mediaRepository.SearchByTextAndUserId(text, Owner.Id) : new List <Media>()); string encodedText = HttpUtility.HtmlEncode(text); IDictionary <string, string> crumbs = new Dictionary <string, string> { { "home", UrlService.UserRoot() }, { "search", string.Empty }, { string.Format("'{0}'", encodedText), UrlService.UserUrl(string.Format("search/ '{0}'", encodedText)) } }; int page = (string.IsNullOrEmpty(cp) ? 1 : Convert.ToInt32(cp)); string setKey = string.Empty; if (media.Count > 0) { setKey = _persistentCollectionService.Set(Authorization.Owner.Username + "_user_Search_" + encodedText, media, Persistence.Temporary); _persistentCollectionService.SetBackUrl(string.Format("{0}/search?text={1}&cp={2}", Authorization.Owner.Username, encodedText, page), SiteCookie); } UserSearchView view = ModelFactory <UserSearchView>(new { SearchText = encodedText, TotalResults = media.Count, Pagination = _paginationService, Set = setKey }); view.Pagination.GeneratePaging(media, page, 20, "?cp={0}&text=" + encodedText); _sidebarView.PopulateView(view, Owner); return(View(view, crumbs)); }
/// <summary> /// Photoes the view. /// </summary> /// <param name="viewLink">The view link.</param> /// <param name="cp">The cp.</param> /// <param name="media">The media.</param> /// <returns></returns> public ActionResult PhotoView(string viewLink, string cp, List <Media> media) { int page = (string.IsNullOrEmpty(cp) ? 1 : Convert.ToInt32(cp)); ManagePhotosView view = GetManagePhotoView(viewLink, new ManagePhotoPostView { CP = cp }, () => media); view = SetAuthorizationAndUrlService(view); view.Set = persistentCollectionService.Set(Authorization.Owner.Username + "Photos" + viewLink, media, Persistence.Permanent); persistentCollectionService.SetBackUrl(Authorization.Owner.Username + "/photos/" + viewLink + "/?cp=" + page, SiteCookie); return(View("Index", view)); }
/// <summary> /// Sets the dynamic collection. /// </summary> /// <param name="key">The key.</param> /// <param name="media">The media.</param> /// <returns></returns> public string SetPersistentCollection(string key, List <Media> media) { PersistentCollection.SetBackUrl(string.Format("{0}/tags", Authorization.Owner.Username), Cookie); string setKey = PersistentCollection.Set(Authorization.Owner.Username + "_" + key + "_recent", media, Persistence.Permanent); return(setKey); }
/// <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)); }
public ActionResult Index(string text, string cp) { List <Media> media = (!string.IsNullOrEmpty(text) ? _mediaRepository.Search(text) : new List <Media>()); string encodedText = HttpUtility.HtmlEncode(text); int page = (string.IsNullOrEmpty(cp) ? 1 : Convert.ToInt32(cp)); string setKey = _persistentCollectionService.Set("global_search" + encodedText, media, Persistence.Temporary); _persistentCollectionService.SetBackUrl(string.Format("search?cp={0}&text={1}", page, encodedText), SiteCookie); SearchView view = new SearchView { SearchText = encodedText, TotalResults = media.Count, Pagination = _paginationService, Set = setKey }; view.Pagination.GeneratePaging(media, page, 20, "?cp={0}&text=" + encodedText); return(View(view)); }
public ActionResult AddDetails(string id) { IDictionary <string, string> crumbs = GetHomeBreadBrumb(); crumbs.Add("upload", UrlService.UserUrl("upload")); crumbs.Add("add details", UrlService.UserUrl(string.Format("adddetails/{0}", HttpUtility.HtmlEncode(id)))); Guid batchId = new Guid(id); List <LoadedMedia> media = _mediaQueueRepository.GetLoadedMedia(batchId); int photoCount = _mediaQueueRepository.GetBatchCount(batchId); string persistentKey = _persistentCollection.Set(string.Format("AddDetails_{0}_{1}", Authorization.Owner.Id, batchId), media.ConvertAll(o => (Media)o), Persistence.Temporary); string mediaKeys = _persistentCollection.Get(persistentKey); AddDetailsView detailsView = ModelFactory <AddDetailsView>(new { mediaKeys, persistentKey, photoCount, batchId }); return(View(detailsView, crumbs)); }
/// <summary> /// Taggeds the specified id. /// </summary> /// <param name="id">The id.</param> /// <returns></returns> public ActionResult Index(int id) { List <Tag> tags = _tagRepository.GetRelatedTagsByYear(Owner.Id, id); List <Media> photos = _recentRepository.RetrieveYearByUserId(id, Owner.Id); string url = string.Format("{0}/year/{1}", Authorization.Owner.Username, id); _persistentCollectionService.SetBackUrl(url, SiteCookie); string key = _persistentCollectionService.Set(Authorization.Owner.Username + "_year_" + id, photos, Persistence.Permanent); IDictionary <string, string> crumbs = new Dictionary <string, string> { { "home", UrlService.UserRoot() }, { "year", string.Empty }, { id.ToString(), UrlService.UserUrl("year/" + id) } }; YearIndexView view = ModelFactory <YearIndexView>(new { Year = id, Media = photos, RelatedTags = _tagService.HyperlinkTheTags(tags, Owner.Username), Set = key }); return(View(view, crumbs)); }