public async Task <IActionResult> Create([Bind("AuctionId,UserName,ShortDescription,StartAmount,CreatedBy,CreatedDate,ModifiedBy,ModifiedDate")] Auction auction)
        {
            if (ModelState.IsValid)
            {
                await _repository.AddAsync(auction);

                await _repository.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(auction));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("UserName,Amount,AuctionId,CreatedBy,CreatedDate")] Bid bid)
        {
            if (ModelState.IsValid)
            {
                await _repository.AddAsync(bid);

                await _repository.SaveChangesAsync();

                return(RedirectToAction(nameof(Details), "Auctions", new { id = bid.AuctionId }));
            }

            ViewData["AuctionId"] = new SelectList(_repository.GetAuctions(), "AuctionId", "ShortDescription", bid.AuctionId);
            return(View(bid));
        }