Esempio n. 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);
        }
Esempio n. 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());
        }
        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());
        }