コード例 #1
0
        public async Task <CandleChart> GetByCandleChartIdAsync(string candleChartId)
        {
            var candleChart = await _context.CandleCharts
                              .Include(c => c.Candles)
                              .Where(c => c.CandleChartId == candleChartId)
                              .SingleOrDefaultAsync();

            if (candleChart != null)
            {
                await _context.Entry(candleChart)
                .Reference(c => c.CandlePeriod).LoadAsync();
            }

            return(candleChart);
        }
コード例 #2
0
        public async Task <IActionResult> PutBalance([FromRoute] int id, [FromBody] Balance balance)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != balance.Id)
            {
                return(BadRequest());
            }

            _context.Entry(balance).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BalanceExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #3
0
        public async Task <IActionResult> KeepUpdateMarket([FromRoute] int id, [FromBody] Market market)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != market.Id)
            {
                return(BadRequest());
            }

            _context.Entry(market).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MarketExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }