public IHttpActionResult Postapp_articulo(app_articulo app_articulo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.app_articulo.Add(app_articulo); try { db.SaveChanges(); } catch (DbUpdateException) { if (app_articuloExists(app_articulo.id_articulo)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = app_articulo.id_articulo }, app_articulo)); }
public IHttpActionResult Putapp_articulo(string id, app_articulo app_articulo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != app_articulo.id_articulo) { return(BadRequest()); } db.Entry(app_articulo).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!app_articuloExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Getapp_articulo(string id) { app_articulo app_articulo = db.app_articulo.Find(id); if (app_articulo == null) { return(NotFound()); } return(Ok(app_articulo)); }
public IHttpActionResult Deleteapp_articulo(string id) { app_articulo app_articulo = db.app_articulo.Find(id); if (app_articulo == null) { return(NotFound()); } db.app_articulo.Remove(app_articulo); db.SaveChanges(); return(Ok(app_articulo)); }