public async Task<IHttpActionResult> PutJornada(int id, Jornada jornada) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != jornada.Id) { return BadRequest(); } db.Entry(jornada).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!JornadaExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public async Task<IHttpActionResult> PostJornada(Jornada jornada) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Jornadas.Add(jornada); await db.SaveChangesAsync(); return CreatedAtRoute("DefaultApi", new { id = jornada.Id }, jornada); }