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)); }
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)); }