예제 #1
0
        public async Task <IActionResult> PutAula(int id, Aula aula)
        {
            if (id != aula.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
예제 #2
0
        public async Task <IActionResult> PutCurso(int id, Curso curso)
        {
            if (id != curso.Id)
            {
                return(BadRequest("ID do curso diferente do informado"));
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CursoExists(id))
                {
                    return(NotFound("Este curso nao existe"));
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }