public ActionResult Image(int id)
 {
     ImageManager manager = new ImageManager(Properties.Settings.Default.ConStr);
     ImageViewModel model = new ImageViewModel();
     UserManager userManager = new UserManager(Properties.Settings.Default.ConStr);
     manager.AddView(id);
     model.Image = manager.GetImage(id);
     model.LikesCount = manager.GetLikesCount(id);
     if(User.Identity.IsAuthenticated)
     {
         model.User = userManager.GetUser(User.Identity.Name);
         model.Liked = manager.CheckIfUserLikedImage(model.User.Id, id);
     }
     return View(model);
 }
 public ActionResult Like(int userId, int imageId)
 {
     ImageManager manager = new ImageManager(Properties.Settings.Default.ConStr);
     manager.AddLike(userId, imageId);
     return Json(new { LikesCount = manager.GetLikesCount(imageId) }, JsonRequestBehavior.AllowGet);
 }