Exemple #1
0
        public async Task <ActionResult <DemandeFormation> > PostDemandeFormation(DemandeFormation demandeFormation)
        {
            _context.demandeFormations.Add(demandeFormation);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetDemandeFormation", new { id = demandeFormation.Id }, demandeFormation));
        }
Exemple #2
0
        public async Task <IActionResult> PutDemandeFormation(int id, DemandeFormation demandeFormation)
        {
            if (id != demandeFormation.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }