public async Task <IActionResult> PutCurso(int codCurso, Curso curso)
        {
            if (!ModelState.IsValid || codCurso != curso.CodCurso)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutAlumno(int id, Alumno alumno)
        {
            if (id != alumno.NroLegajo || !ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

            return(NoContent());
        }
Exemple #3
0
        public async Task <IActionResult> PutMateria(int id, Materia materia)
        {
            if (id != materia.CodMateria)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #4
0
        public async Task <IActionResult> PutProfesor(int id, Profesor profesor)
        {
            if (!ModelState.IsValid || profesor.ProfesorId != id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }