Beispiel #1
0
        public void Vote(VoteRequest request, IVoteView view)
        {
            UserBiz userBiz = new UserBiz();

            if (userBiz.GetCurrentUser().RandomCode != request.RandomCode)
            {
                view.ShowVoteResult("验证码错误");
            }
            else if (userBiz.GetCurrentUser().HaveVoteCount > 9)
            {
                view.ShowVoteResult("投票失败,您已经投过10张票啦~~");
            }
            else
            {
                VoteBiz biz = new VoteBiz();
                if (biz.Vote(new Vote()
                {
                    ProductId = request.ProductId, IP = request.IP
                }))
                {
                    userBiz.GetCurrentUser().HaveVoteCount++;
                    view.ShowVoteResult("投票成功");
                }
                else
                {
                    view.ShowVoteResult("投票失败,您所在的IP地址已经投过10张票啦~");
                }
            }
        }
Beispiel #2
0
        public IActionResult Index()
        {
            var a = new VoteBiz();

            return(View());
        }