예제 #1
0
        public IActionResult Detail(int id)
        {
            var image = _imageService.GetById(id);
            var model = new GalleryDetailModel()
            {
                Id    = image.Id,
                Title = image.Title,
                Url   = image.Url,
                Tags  = image.Tags.Select(t => t.Description).ToList()
            };

            return(View(model));
        }
예제 #2
0
        public IActionResult Detail(int id)
        {
            var image = GetById(id);
            var model = new GalleryDetailModel()
            {
                ID        = image.ID,
                Title     = image.Title,
                CreatedOn = image.Created,
                Url       = image.Url
                            //Tags = image.Tags.Selct(t => t.Description).ToList()
            };

            return(View(model));
        }
예제 #3
0
        public IActionResult Detail(int id)
        {
            var screenshot = _galleryService.GetById(id);

            var model = new GalleryDetailModel
            {
                Id      = screenshot.Id,
                Title   = screenshot.Title,
                Created = screenshot.Created,
                Url     = screenshot.Url,
                Tags    = screenshot.Tags.Select(t => t.Description).ToList()
            };

            return(View(model));
        }
예제 #4
0
        public IActionResult Detail(int id)
        {
            var image = _imageService.GetById(id);  // Get id by Id by means of imageservice
            // Map all properties of the image gotten from the database on to properties defined in this view model
            var model = new GalleryDetailModel()
            {
                Id        = image.Id,
                Title     = image.Title,
                CreatedOn = image.CreatedOn,
                Url       = image.Url,
                Tags      = image.Tags.Select(t => t.Description).ToList()
            };

            return(View(model));
        }
예제 #5
0
        public IActionResult Detail(int id)
        {
            var image = service.GetById(id);

            var model = new GalleryDetailModel
            {
                Id        = image.Id,
                Title     = image.Title,
                CreatedOn = image.Created,
                Url       = image.Url,
                Tags      = image.Tags.Select(tag => tag.Description).ToList()
            };

            return(View(model));
        }
예제 #6
0
        public IActionResult Detail(int id)
        {
            // Use the service to retrieve the image by it's ID
            var image = _imageService.GetById(id);

            // Push that into the view-model
            var model = new GalleryDetailModel()
            {
                Id        = image.Id,
                Title     = image.Title,
                CreatedOn = image.Created,
                Url       = image.Url,
                // Dump the collection of tags and return them as a list
                Tags = image.Tags.Select(t => t.Description).ToList()
            };

            return(View(model));
        }
예제 #7
0
        public GalleryDetailModel GetGalleryDetailModel(Post post)
        {
            var model = new GalleryDetailModel()
            {
                Id          = post.Id,
                Title       = post.Title,
                Description = post.Description,
                Created     = post.Created,
                Url         = post.Url,
                Tags        = post.Tags.Select(t => t.Title).ToList(),
                Likes       = post.Likes.ToList(),
                Dislikes    = post.Dislikes.ToList(),
                Comments    = post.Comments.ToList(),
                User        = post.User,
                IsSetLike   = post.Likes.Any(l => l.UserId == _userService.GetCurrentUser(_httpCtxAcc.HttpContext.User).Id),
            };

            return(model);
        }
예제 #8
0
        public IActionResult Detail(int id)
        {
            var post  = _postService.GetById(id);
            var model = new GalleryDetailModel()
            {
                Id          = post.Id,
                Title       = post.Title,
                Description = post.Description,
                Created     = post.Created,
                Url         = post.Url,
                Tags        = post.Tags.Select(t => t.Title).ToList(),
                Likes       = post.Likes.ToList(),
                Dislikes    = post.Dislikes.ToList(),
                Comments    = post.Comments.ToList(),
                IsSetLike   = post.Likes.Any(l => l.UserId == User.FindFirst(ClaimTypes.NameIdentifier).Value),
                User        = _userService.GetCurrentUser(HttpContext.User)
            };

            return(View(model));
        }
예제 #9
0
        public async Task <IActionResult> Details(int?id)
        {
            ApplicationUser currentUser = await _userManager.GetUserAsync(User);

            var image = _context.Galleries.Where(img => img.Id == id && img.UserName == currentUser.UserName).FirstOrDefault();

            if (id != null && image != null)
            {
                var model = new GalleryDetailModel()
                {
                    Id        = image.Id,
                    User      = image.UserName,
                    Title     = image.Title,
                    CreatedOn = image.Created,
                    Url       = image.Url
                };
                return(View(model));
            }
            return(NotFound());
        }
예제 #10
0
        public IActionResult Detail(int id)
        {
            var image = _imageService.GetById(id);

            if (image == null)
            {
                return(RedirectToAction("/Index"));
            }

            var model = new GalleryDetailModel()
            {
                Id        = image.Id,
                Title     = image.Title,
                CreatedOn = image.Created,
                Url       = image.Url,
                Tags      = image.Tags.Select(t => t.Description).ToList()
            };

            return(View(model));
        }