public async Task <ActionResult <Etablissement> > PutEtablissement(long id, Etablissement etablissement)
        {
            if (id != etablissement.Id)
            {
                return(BadRequest());
            }

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

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

            return(etablissement);
        }
        public async Task <IActionResult> PutRole(long id, Role role)
        {
            if (id != role.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#3
0
        public async Task <IActionResult> PutDepartement(long id, Departement departement)
        {
            if (id != departement.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }