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)); }
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)); }