public ActionResult ReturnBet(BetDto model) { if (ModelState.IsValid) { try { var bet = _repo.Single <Bet>(model.ID); if (bet != null) { if (bet.IsWin.HasValue) { throw new Exception("此投注已经发放了奖励"); } if (bet.UserID != AcnID) { throw new Exception("此投注非当前用户的投注"); } bet.ReturnBet(); //退注成功 } TempData["DataUrl"] = $"data-url=/Casino/GameBet/{model.MatchGuid}"; return(RedirectToAction("GameBet", "Casino", new { id = model.MatchGuid })); } catch (Exception ex) { ModelState.AddModelError("Warn", ex.Message); } } else { ModelState.AddModelError("Warn", "请正确填写比赛结果比分"); } model = BetDto.Single(model.ID); return(View(model)); }
// 退还投注 // GET: /Casino/ReturnBet/id public ActionResult ReturnBet(int id) { var model = BetDto.Single(id); return(View(model)); }