public IHttpActionResult Posttbl_sku(tbl_sku tbl_sku) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tbl_sku.Add(tbl_sku); try { db.SaveChanges(); } catch (DbUpdateException) { if (tbl_skuExists(tbl_sku.sku_barcode)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = tbl_sku.sku_barcode }, tbl_sku)); }
public IHttpActionResult Puttbl_sku(double id, tbl_sku tbl_sku) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tbl_sku.sku_barcode) { return(BadRequest()); } db.Entry(tbl_sku).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!tbl_skuExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Gettbl_sku(double id) { tbl_sku tbl_sku = db.tbl_sku.Find(id); if (tbl_sku == null) { return(NotFound()); } return(Ok(tbl_sku)); }
public IHttpActionResult Deletetbl_sku(double id) { tbl_sku tbl_sku = db.tbl_sku.Find(id); if (tbl_sku == null) { return(NotFound()); } db.tbl_sku.Remove(tbl_sku); db.SaveChanges(); return(Ok(tbl_sku)); }