public async Task <IHttpActionResult> PutCentro_Costos(int id, Centro_Costos centro_Costos) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != centro_Costos.Cod) { return(BadRequest()); } db.Entry(centro_Costos).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Centro_CostosExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetCentro_Costos(int id) { Centro_Costos centro_Costos = await db.Centro_Costos.FindAsync(id); if (centro_Costos == null) { return(NotFound()); } return(Ok(centro_Costos)); }
public async Task <IHttpActionResult> PostCentro_Costos(Centro_Costos centro_Costos) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Centro_Costos.Add(centro_Costos); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = centro_Costos.Cod }, centro_Costos)); }
public async Task <IHttpActionResult> DeleteCentro_Costos(int id) { Centro_Costos centro_Costos = await db.Centro_Costos.FindAsync(id); if (centro_Costos == null) { return(NotFound()); } db.Centro_Costos.Remove(centro_Costos); await db.SaveChangesAsync(); return(Ok(centro_Costos)); }