Ejemplo n.º 1
0
        public ActionResult GetCount(int id)
        {
            var   manager = new ImageShareManager(Properties.Settings.Default.ConStr);
            Image image   = manager.GetImage(id);

            return(Json(new { viewCount = image.ViewCount, likes = manager.GetLikesCount(id) }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 3
0
        public ActionResult GetLikes(int imageId)
        {
            var manager = new ImageShareManager(Properties.Settings.Default.ConStr);

            return(Json(new { likes = manager.GetLikesCount(imageId) }, JsonRequestBehavior.AllowGet));
        }