Esempio n. 1
0
        public ActionResult Save(long?postID)
        {
            var model = new PostViewModel
            {
                CreateDate    = DateTime.Now,
                Categories    = _categoryRepository.GetAll(),
                PostGalleries = _postGalleryRepository.GetAll()
            };

            if (!postID.HasValue)
            {
                return(View(model: model));
            }

            var post = _postRepository.GetByID((long)postID);

            var tags = _postRepository.GetTagsPost((long)postID);

            model.ID               = postID;
            model.Title            = post.Title;
            model.ShortDescription = post.ShortDescription;
            model.LongDescription  = post.LongDescription;
            model.CategoryID       = post.CategoryID;
            model.Actived          = post.Actived;
            model.IsGallery        = post.IsGallery;
            model.SelectedTags     = tags == null ? null : string.Join(",", tags);
            model.MainImageUrl     = post.MainImageUrl;
            model.UserID           = post.AuthorID;
            model.PostGalleryID    = post.PostGalleryID;


            return(View(model: model));
        }
Esempio n. 2
0
		public ActionResult ListPostGallery()
		{
			var model = new GalleryViewModel
			{
				PostGalleries = _postGalleryRepository.GetAll()
			};

			return View(model);
		}