예제 #1
0
        public async Task <IActionResult> PutTurma([FromRoute] int id, [FromBody] Turma turma)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != turma.TurmaId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
예제 #2
0
        public async Task <IActionResult> PutPlanoDeEnsino([FromRoute] int id, [FromBody] PlanoDeEnsino planoDeEnsino)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != planoDeEnsino.PlanoDeEnsinoId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }