コード例 #1
0
ファイル: BetsController.cs プロジェクト: mishadev/XOracle
        public async Task CreateBet(BetBindingModel model)
        {
            IUser account = await this._userManager.FindByNameAsync(User.Identity.Name);

            CreateBetResponse response = await this._betsService.CreateBet(
                new CreateBetRequest
            {
                AccountId    = Guid.Parse(account.Id),
                EventId      = model.EventId,
                BetAmount    = model.BetAmount,
                OutcomesType = model.OutcomesType
            });
        }
コード例 #2
0
        public IActionResult RegisterBet(BetBindingModel model)
        {
            var evnt = this.DbContext.Events.FirstOrDefault(e => e.Address == model.EventAddress);

            if (evnt != null)
            {
                evnt.Bets.Add(new Bet()
                {
                    Address = model.CustomerAddress
                });
                this.DbContext.SaveChanges();
            }

            return(this.Ok());
        }