public void clearData()
 {
     BlogImages    = null;
     BlogImages    = new List <Images>();
     GalleryImages = null;
     GalleryImages = new List <List <Images> >();
     GmapsMarker   = new List <GMapsMarker>();
     blog          = null;
     blogdata      = null;
 }
        public ActionResult Preview()
        {
            //TODO: move to service!
            BlogOutput data = new BlogOutput();
            var        blog = service.GetBlogData();

            if (blog != null && !String.IsNullOrEmpty(blog.titel))
            {
                data.Title       = blog.titel;
                data.Subtitle    = blog.subtitel;
                data.Elements    = new List <Element>();
                data.GMapsMarker = new List <GMapsMarker>();

                //add text to elements
                foreach (var text in blog.text)
                {
                    data.Elements.Add(new TextElement {
                        value = text.value, position = text.position
                    });
                }

                //add image and slideshow data into elements
                data.Elements.AddRange(mapImages(service.GetImages(), blog.images.ToList(), service.GetGallery()));

                //add video into elements
                foreach (var video in blog.videos)
                {
                    data.Elements.Add(new VideoElement {
                        Src = video.src, position = video.position
                    });
                }

                //sort, based on position
                data.Elements = data.Elements.OrderBy(x => x.position).ToList();


                data.GMapsMarker.AddRange(blog.gmapsMarker);
                if (data.GMapsMarker.Count > 0)
                {
                    data.IsGoogleMapsVisible = true;
                }

                service.SetBlog(data);
                //shove elements into view or display
                return(View(data));
            }
            else
            {
                data.ErrorMessage = "No preview data available. Please add elements to your blog and then hit preview.";
                return(View(data));
            }
        }
 public void SetBlog(BlogOutput blog)
 {
     blogdata = blog;
 }