public IHttpActionResult Puttipo_producto(int id, tipo_producto tipo_producto) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != tipo_producto.id_tipo_producto) { return BadRequest(); } db.Entry(tipo_producto).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!tipo_productoExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult Posttipo_producto(tipo_producto tipo_producto) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.tipo_producto.Add(tipo_producto); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = tipo_producto.id_tipo_producto }, tipo_producto); }