Exemplo n.º 1
0
        public async Task <dynamic> MakeDepositOffer([FromBody] DepositOfferModel depositModel)
        {
            if (!TryValidateModel(depositModel))
            {
                return(BadRequest(depositModel));
            }

            var steamId = User.GetSteamId();
            var items   = depositModel.Items.Select(item => new Item
            {
                AssetId   = item.AssetId,
                ContextId = item.ContextId,
                AppId     = item.AppId
            }).ToList();

            try
            {
                return(await _steamService.MakeDepositOfferAsync(steamId, items));
            }
            catch (TradeLinkNotSetExeption)
            {
                return(BadRequest("User does not have a valid tradelink"));
            }
            catch (InventoryLimitExceeded e) { return(BadRequest(e.Message)); }
            catch (ItemDescriptionNotInDatabase e) { return(BadRequest(e.Message)); }
            catch (ItemInOfferNotMatchingLowestValueRuleExecption e) { return(BadRequest(e.Message)); }
            catch (NoBotInDatabaseException)
            {
                await _steamService.StartAllBotsAsync(new StartAllBotsRequest());

                throw;
            }
        }
Exemplo n.º 2
0
 public async Task <dynamic> StartBots()
 {
     return(await _steamService.StartAllBotsAsync(new StartAllBotsRequest()));
 }