public IHttpActionResult PutAula(int id, Aula aula) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != aula.idAula) { return(BadRequest()); } db.Entry(aula).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AulaExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Post(Alumno alumno) { db.Alumno.Add(alumno); try { db.SaveChanges(); } catch (Exception e) { return(BadRequest("Error en el Alta")); } return(Created("ApiAlumnos", alumno)); }