コード例 #1
0
        public ActionResult AuctionDetail(long?id)
        {
            if (!id.HasValue)
            {
                return(RedirectToAction("Category"));
            }
            InitCurrentEvent();
            Event         evnt    = ViewData["CurrentEvent"] as Event;
            AuctionDetail auction = AuctionRepository.GetAuctionDetail(id.Value, evnt.ID, true);

            if (auction == null)
            {
                return(RedirectToAction("Category"));
            }
            SessionUser cuser = AppHelper.CurrentUser;

            if (auction.Status == Consts.AuctionStatus.Pending || auction.Status == Consts.AuctionStatus.Open)
            {
                AuctionUserInfo aui = new AuctionUserInfo();
                if (cuser != null)
                {
                    aui.IsRegisterForEvent = EventRepository.IsUserRegisterForEvent(cuser.ID, auction.LinkParams.Event_ID);
                    aui.IsInWatchList      = AuctionRepository.IsUserWatchItem(cuser.ID, auction.LinkParams.ID);
                }
                else
                {
                    aui = new AuctionUserInfo {
                        IsInWatchList = false, IsRegisterForEvent = false
                    }
                };
                ViewData["AuctionUserInfo"] = aui;

                AuctionShort ashort = AuctionRepository.GetAuctionDetailResult(auction.LinkParams.ID, true);
                ViewData["AuctionShort"]  = ashort;
                ViewData["BiddingResult"] = BidRepository.CurrentAuctionBiddingResult(auction.LinkParams.ID, cuser == null ? null : (long?)cuser.ID, ashort.Price);
                if (ashort.Bids != 0)
                {
                    if (auction.CloseStep == 1 && cuser != null)
                    {
                        ViewData["IsUserHasRightsToBid"] = BidRepository.IsUserCanParticipateInBidding(auction.LinkParams.ID, cuser.ID);
                    }
                }
            }
            return(View("AuctionDetailNew", auction));
        }