Esempio n. 1
0
        public async Task <ActionResult <CommandeInterne> > PostCommandeInterne(CommandeInterne commandeInterne)
        {
            _context.CommandeInterne.Add(commandeInterne);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCommandeInterne", new { id = commandeInterne.Id }, commandeInterne));
        }
Esempio n. 2
0
        public async Task <IActionResult> PutCommandeInterne(int id, CommandeInterne commandeInterne)
        {
            if (id != commandeInterne.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }