public IHttpActionResult Puttipo_post(int id, tipo_post tipo_post) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tipo_post.id_tipo_post) { return(BadRequest()); } db.Entry(tipo_post).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!tipo_postExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Gettipo_post(int id) { tipo_post tipo_post = db.tipo_post.Find(id); if (tipo_post == null) { return(NotFound()); } return(Ok(tipo_post)); }
public IHttpActionResult Posttipo_post(tipo_post tipo_post) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tipo_post.Add(tipo_post); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = tipo_post.id_tipo_post }, tipo_post)); }
public IHttpActionResult Deletetipo_post(int id) { tipo_post tipo_post = db.tipo_post.Find(id); if (tipo_post == null) { return(NotFound()); } db.tipo_post.Remove(tipo_post); db.SaveChanges(); return(Ok(tipo_post)); }