示例#1
0
        public ActionResult ShowImage(int id)
        {
            var manager = new ImageShareManager(Properties.Settings.Default.ConStr);

            manager.IncrementCount(id);
            var image     = manager.GetImage(id);
            var viewModel = new ShowImageViewModel();

            viewModel.Image = image;
            return(View(viewModel));
        }
示例#2
0
        public ActionResult ShowImage(int id)
        {
            var manager = new ImageShareManager(Properties.Settings.Default.ConStr);

            manager.IncrementCount(id);
            var image     = manager.GetImage(id);
            var viewModel = new ShowImageViewModel();

            viewModel.Image           = image;
            viewModel.Likes           = manager.GetLikesCount(id);
            viewModel.IsAuthenticated = User.Identity.IsAuthenticated;
            if (User.Identity.IsAuthenticated)
            {
                viewModel.HasUserLiked = manager.HasUserLiked(User.Identity.Name, id);
            }
            return(View(viewModel));
        }