Beispiel #1
0
        /// <summary>
        /// Renders the view.
        /// </summary>
        /// <returns></returns>
        public ManagePhotosView RenderView(string view, ManagePhotoPostView postView, Func <List <Media> > retrieve)
        {
            ManagePhotosView managePhotosView = RenderMedia(postView, retrieve, "ManagedPhotoView");

            managePhotosView.BreadCrumbs     = SetBreadCrumb(view);
            managePhotosView.TabName         = view;
            managePhotosView.RenderAdminTags = _tagService.HyperlinkTheAdminTags;

            return(managePhotosView);
        }
Beispiel #2
0
        /// <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));
        }
Beispiel #3
0
        /// <summary>
        /// Photoes the view.
        /// </summary>
        /// <param name="viewLink">The view link.</param>
        /// <param name="postView">The post view.</param>
        /// <param name="media">The media.</param>
        /// <returns></returns>
        public ActionResult PhotoView(string viewLink, ManagePhotoPostView postView, List <Media> media)
        {
            int    page        = (string.IsNullOrEmpty(postView.CP) ? 1 : Convert.ToInt32(postView.CP));
            string queryValues = (string.IsNullOrEmpty(postView.Text)
                                      ? "?cp=" + page
                                      : "?cp=" + page + "&text=" + HttpUtility.HtmlEncode(postView.Text));
            ManagePhotosView view = GetManagePhotoView(viewLink, postView, () => media);

            view = SetAuthorizationAndUrlService(view);

            view.Set = persistentCollectionService.Set(Authorization.Owner.Username + "Photos" + viewLink + "_" + postView.Text, media, Persistence.Permanent);
            persistentCollectionService.SetBackUrl(Authorization.Owner.Username + "/photos/" + viewLink + "/" + queryValues, SiteCookie);

            return(View("Index", view));
        }
Beispiel #4
0
        /// <summary>
        /// Renders the view.
        /// </summary>
        /// <param name="viewLink">The view link.</param>
        /// <param name="postView">The post view.</param>
        /// <param name="retrieve"></param>
        /// <returns></returns>
        public ManagePhotosView RenderView(string viewLink, ManagePhotoPostView postView, Func <List <Media> > retrieve)
        {
            AddTagsToMedia(postView);

            ManagePhotosView managePhotosView = RenderMedia(postView, retrieve, "ManagedPhotoView");

            managePhotosView.UIMessage   = (postView.MediaId != null ? string.Format("Tags were successfully added to {0} photo(s)", postView.MediaId.Length) : string.Empty);
            managePhotosView.BreadCrumbs = SetBreadCrumb(viewLink);

            managePhotosView.TabName         = viewLink;
            managePhotosView.RenderAdminTags = _tagService.HyperlinkTheAdminTags;
            managePhotosView.Authorization   = authorization;

            return(managePhotosView);
        }
        /// <summary>
        /// Renders the apply action.
        /// </summary>
        /// <param name="postView">The post view.</param>
        /// <param name="retrieve">The retrieve.</param>
        /// <param name="viewName">Name of the view.</param>
        /// <param name="format">The format.</param>
        /// <returns></returns>
        protected ManagePhotosView RenderMedia(ManagePhotoPostView postView, Func <List <Media> > retrieve, string viewName, string format)
        {
            ManagePhotosView view  = new ManagePhotosView();
            List <Media>     media = retrieve();

            int index = (string.IsNullOrEmpty(postView.CP) ? 1 : Convert.ToInt32(postView.CP));

            view.MediaStatusCount = mediaRepository.GetMediaStatusCountByUserId(user.Id);
            view.Pagination       = _paginationService;
            view.TotalResults     = media.Count;
            view.PartialView      = viewName;
            view.UIMessage        = string.Empty;
            view.Authorization    = authorization;
            view.Pagination.GeneratePaging(media, index, 20, format);

            return(view);
        }
        /// <summary>
        /// Manages the specified id.
        /// </summary>
        /// <param name="album">The album.</param>
        /// <returns></returns>
        public ActionResult Photos(Album album)
        {
            List <MediaWithAlbumPosition> media = _mediaRepository.GetMediaWithAlbumPositionByAlbumId(album.AlbumId, Owner.Id);
            string albumCrumbs = GetAlbumCrumbs(album);

            IDictionary <string, string> breadCrumbs = GetBreadCrumbs();

            breadCrumbs.Add(album.Name, string.Empty);
            breadCrumbs.Add("photos", string.Empty);

            string setKey = _persistentCollectionService.Set(Authorization.Owner.Username + "_ManageAlbum_" + album.AlbumId, media.ConvertAll(o => (Media)o), Persistence.Permanent);

            _persistentCollectionService.SetBackUrl(Authorization.Owner.Username + "/albums/photos/" + album.AlbumId, SiteCookie);

            ManagePhotosView manageView = ModelFactory <ManagePhotosView>(new { album, media, albumCrumbs, Set = setKey });

            return(View(manageView, breadCrumbs));
        }
        /// <summary>
        /// Renders the view.
        /// </summary>
        /// <param name="view">The view.</param>
        /// <param name="postView">The post view.</param>
        /// <param name="retrieve">The retrieve.</param>
        /// <returns></returns>
        public ManagePhotosView RenderView(string view, ManagePhotoPostView postView, Func <List <Media> > retrieve)
        {
            UpdatePhotosWithApplyAction(postView);

            ManagePhotosView managePhotosView = RenderMedia(postView, retrieve, "ManagedPhotoView");

            managePhotosView.RenderAdminTags = _tagService.HyperlinkTheAdminTags;

            managePhotosView.BreadCrumbs = SetBreadCrumb(view);
            CultureInfo cultureInfo      = Thread.CurrentThread.CurrentCulture;
            string      viewName         = cultureInfo.TextInfo.ToTitleCase(postView.MediaStatus);
            string      friendlyViewName = (string.Equals(viewName, "Innetwork", StringComparison.InvariantCultureIgnoreCase)
                                           ? "In Network"
                                           : viewName);

            if (postView.MediaId != null && postView.MediaId.Length > 0)
            {
                managePhotosView.UIMessage = string.Format("{0} photo(s) moved to {1}.",
                                                           postView.MediaId.Length, friendlyViewName);
            }

            managePhotosView.TabName = view;
            return(managePhotosView);
        }