public async Task <ActionResult> Bet(int?auctionId, decimal betValue) { if (auctionId == null || auctionId < 1) { return(RedirectToAction("Index", "Home")); } if (betValue <= 0) { ModelState.AddModelError("betValue", "Bet value can't be negative."); } if (ModelState.IsValid) { if (await bidService.PlaceBet((int)auctionId, User.Identity.Name, betValue)) { return(RedirectToAction("Details", new { id = auctionId })); } else { return(RedirectToAction("Details", new { id = auctionId })); } } TempData["ViewData"] = ViewData; return(RedirectToAction("Details", new { id = auctionId })); }