Exemplo n.º 1
0
        public async Task <ActionResult <WheelChain> > PostWheelChain(WheelChain wheelChain)
        {
            _context.WheelChains.Add(wheelChain);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetWheelChain", new { id = wheelChain.ID }, wheelChain));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutWheelChain(int id, WheelChain wheelChain)
        {
            if (id != wheelChain.ID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }