public IHttpActionResult PostCat_RH(Cat_RH cat_RH) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Cat_RH.Add(cat_RH); try { db.SaveChanges(); } catch (DbUpdateException) { if (Cat_RHExists(cat_RH.Id_RH)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = cat_RH.Id_RH }, cat_RH); }
public IHttpActionResult PutCat_RH(int id, Cat_RH cat_RH) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != cat_RH.Id_RH) { return BadRequest(); } db.Entry(cat_RH).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Cat_RHExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }