public IHttpActionResult PutrangosPreciosModel(rangosPreciosModel rangosPreciosModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } //if (id != rangosPreciosModel.idRango) //{ // return BadRequest(); //} db.Entry(rangosPreciosModel).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException ex) { return(BadRequest(ex.Message)); //if (!rangosPreciosModelExists(id)) //{ // return NotFound(); //} //else //{ // throw; //} } return(StatusCode(HttpStatusCode.OK)); }
public IHttpActionResult GetrangosPreciosModel(long id) { rangosPreciosModel rangosPreciosModel = db.rangosPreciosModels.Find(id); if (rangosPreciosModel == null) { return(NotFound()); } return(Ok(rangosPreciosModel)); }
public IHttpActionResult PostrangosPreciosModel(rangosPreciosModel rangosPreciosModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.rangosPreciosModels.Add(rangosPreciosModel); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = rangosPreciosModel.idRango }, rangosPreciosModel)); }
public IHttpActionResult DeleterangosPreciosModel(long id) { rangosPreciosModel rangosPreciosModel = db.rangosPreciosModels.Find(id); if (rangosPreciosModel == null) { return(NotFound()); } db.rangosPreciosModels.Remove(rangosPreciosModel); db.SaveChanges(); return(Ok(rangosPreciosModel)); }