public HttpResponseMessage Post(PlayInput data) { var account = base.SuperplayerRequestContext.Account; var now = DateTime.Now.EnsureAsUtc().ClearSeconds().ClearMilliSeconds(); var geolocation = base.GeoCoordenate; try { var result = new TrackProjectionWrapper { Tracks = GetTracks(data.PlaylistsId, account, now, geolocation), }; return Request.CreateResponse(HttpStatusCode.OK, result); } finally { SavePlayedPlaylists(data.PlaylistsId, account, geolocation); } }
public HttpResponseMessage Post(PlayInput data) { var account = base.SuperplayerRequestContext.Account; var now = DateTime.Now.EnsureAsUtc().ClearSeconds().ClearMilliSeconds(); var geolocation = base.GeoCoordenate; try { var result = new TrackProjectionWrapper { Tracks = GetTracks(data.PlaylistsId, account, now, geolocation), }; return(Request.CreateResponse(HttpStatusCode.OK, result)); } finally { SavePlayedPlaylists(data.PlaylistsId, account, geolocation); } }
public override Int64Value Play(PlayInput input) { Assert(input.BuyAmount > BetMinimumAmount, "Invalid bet amount."); var playerInformation = RegisterOrGetPlayerInformation(); Assert(playerInformation.Bouts.Count < BetLimit, "There are too many lottery tickets, please draw first"); Context.LogDebug(() => $"Playing with amount {input.BuyAmount}"); if (State.TokenContract.Value == null) { State.TokenContract.Value = Context.GetContractAddressByName(SmartContractConstants.TokenContractSystemName); } State.TokenContract.TransferFrom.Send(new TransferFromInput { From = Context.Sender, To = Context.Self, Amount = input.BuyAmount, Symbol = input.TokenSymbol, Memo = "Enjoy!" }); var boutInformation = new BoutInformation { PlayBlockHeight = Context.CurrentHeight, PlayId = Context.TransactionId, Amount = input.BuyAmount, BoutType = input.BuyType, TokenSymbol = input.TokenSymbol, BetTime = Context.CurrentBlockTime }; playerInformation.Bouts.Add(boutInformation); State.PlayerInformation[Context.Sender] = playerInformation; return(new Int64Value { Value = Context.CurrentHeight.Add(GetLagHeight()) }); }
internal PlayGameEventArgs(PlayInput PlayInput) { this.PlayInput = PlayInput; }