Пример #1
0
        public ActionResult PizOrUnpiz(string id, string type)
        {
            try
            {
                var piz = type.Replace("#", "") == "Piz" ? _service.VotePost(id, SessionManager.UserLogged.UserId) :
                                _service.UnvotePost(id, SessionManager.UserLogged.UserId);

                var flag = _service.CheckVotePost(id, SessionManager.UserLogged.UserId);
                var data = _service.GetVoteByPost(id);
                var model = new PizModel()
                    {
                        VotePost = data,
                        Type = flag
                    };

                return PartialView(model);
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message);
                return PartialView();

            }
            
        }
Пример #2
0
        public ActionResult PizOrUnpiz(string id)
        {
            var model = new PizModel { AlbumId = id };
            var data2 = PostRepository.GetSingleAlbum(id);
            if (SessionManager.IsLoggedIn)
            {
                var data1 = PostRepository.CheckPizAlbumOrImage(SessionManager.UserLogged.UserId, id);
                model.Type = data1.Code == "-1"; //Aready piz
            }
            model.TotalPiz = data2.Album.TotalPiz;
            model.TotalView = data2.Album.TotalView;
            model.AlbumPermalink = data2.Album.AlbumPermalink;

            return View(model);
        }
Пример #3
0
 public ActionResult PizOrUnpiz(string id)
 {
     try
     {
         var data = _service.GetVoteByPost(id);
         var model = new PizModel { VotePost = data };
         if (SessionManager.IsLoggedIn)
             model.Type = _service.CheckVotePost(id, SessionManager.UserLogged.UserId);
         
         return PartialView(model);
     }
     catch (Exception ex) 
     {
         Logger.Error(ex.Message);
         return PartialView();
     }
     
 }