예제 #1
0
        public async Task <ActionResult <DemandeAvance> > PostDemandeAvance(DemandeAvance demandeAvance)
        {
            _context.demandeAvances.Add(demandeAvance);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetDemandeAvance", new { id = demandeAvance.Id }, demandeAvance));
        }
예제 #2
0
        public async Task <IActionResult> PutDemandeAvance(int id, DemandeAvance demandeAvance)
        {
            if (id != demandeAvance.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }