public IHttpActionResult PutVoluntarioxCompetencia(int id, VoluntarioxCompetencia voluntarioxCompetencia) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != voluntarioxCompetencia.iId) { return(BadRequest()); } db.Entry(voluntarioxCompetencia).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!VoluntarioxCompetenciaExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetVoluntarioxCompetencia(int id) { VoluntarioxCompetencia voluntarioxCompetencia = db.VoluntarioxCompetencia.Find(id); if (voluntarioxCompetencia == null) { return(NotFound()); } return(Ok(voluntarioxCompetencia)); }
public IHttpActionResult PostVoluntarioxCompetencia(VoluntarioxCompetencia voluntarioxCompetencia) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.VoluntarioxCompetencia.Add(voluntarioxCompetencia); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = voluntarioxCompetencia.iId }, voluntarioxCompetencia)); }
public IHttpActionResult DeleteVoluntarioxCompetencia(int id) { VoluntarioxCompetencia voluntarioxCompetencia = db.VoluntarioxCompetencia.Find(id); if (voluntarioxCompetencia == null) { return(NotFound()); } db.VoluntarioxCompetencia.Remove(voluntarioxCompetencia); db.SaveChanges(); return(Ok(voluntarioxCompetencia)); }