public ActionResult JoinToAuctionId(int auctionId) { var auction = this.dataAuction.GetById(auctionId); var currentUserId = this.User.Identity.GetUserId(); var currentUser = this.dataUser.GetById(currentUserId); auction.Bidders.Add(currentUser); this.dataAuction.Save(); var auctionModel = new ActiveAuctionViewModel { Id = auction.Id, Name = auction.Name, Value = auction.BidStep, InitialPrice = auction.InitialPrice, BidStep = auction.BidStep, Active = auction.Active, Items = auction.Items, Bidders = auction.Bidders }; var bidders = new List<SelectListItem> { new SelectListItem { Text = "All", Value = "All" } }; var allBidders = auction.Bidders .Select(u => new SelectListItem { Text = u.UserName, Value = u.Id }) .ToList(); bidders.AddRange(allBidders); ViewBag.Bidders = bidders; return View("Bid", auctionModel); }
// Just for client-side validation public void SendMessage(ActiveAuctionViewModel auction) { }