Exemplo n.º 1
0
        public async Task <IActionResult> PutDTCInventory(string id, DTCInventory dTCInventory)
        {
            if (id != dTCInventory.DTCTechnicalId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <ActionResult <DTCInventory> > PostDTCInventory(DTCInventory dTCInventory)
        {
            _context.DTCInventories.Add(dTCInventory);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (DTCInventoryExists(dTCInventory.DTCTechnicalId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetDTCInventory", new { id = dTCInventory.DTCTechnicalId }, dTCInventory));
        }