示例#1
0
        public async Task <IActionResult> AuctionBid([FromRoute] int id)
        {
            var auction = await auctionHouseProxy.GetEntityAsync <AuctionItemBidModel>(baseUrl + id);

            if (auction.BidCustomPhone == null)
            {
                auction.BidCustomPhone = 0;
            }
            var auctionBidPage = new ItemBidPageModel
            {
                ItemNumber      = auction.ItemNumber,
                ItemDescription = auction.ItemDescription,
                RatingPrice     = auction.RatingPrice,
                BidPrice        = auction.BidPrice,
                BidCustomName   = auction.BidCustomName,
                BidCustomPhone  = (int)auction.BidCustomPhone,
                BidTimestamp    = auction.BidTimestamp
            };

            return(View(auctionBidPage));
        }
示例#2
0
        public async Task <IActionResult> SendAuctionBid([FromRoute] int id, [FromForm] ItemBidPageModel sendbid)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            Bid bid = new Bid {
                ItemNumber  = sendbid.ItemNumber,
                Price       = sendbid.BidPrice,
                CustomName  = sendbid.BidCustomName,
                CustomPhone = sendbid.BidCustomPhone
            };
            var auction = await auctionHouseProxy.GetEntityAsync <AuctionItemBidModel>(baseUrl + id);

            HttpResponseMessage response = null;

            response = await auctionHouseProxy.PostAuctionBidAsync(id, bid, baseUrl);

            if (response.IsSuccessStatusCode)
            {
                return(RedirectToAction("AuctionBid", new { id = id }));
            }
            return(RedirectToAction("AuctionBid", new { id = id }));
        }