public async Task <IHttpActionResult> PutShopBridgeProduct(int id, ShopBridgeProduct shopBridgeProduct) { //if (!ModelState.IsValid) //{ // return BadRequest(ModelState); //} if (id != shopBridgeProduct.ProductId) { return(BadRequest()); } db.Entry(shopBridgeProduct).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShopBridgeProductExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetShopBridgeProduct(int id) { ShopBridgeProduct shopBridgeProduct = await db.ShopBridgeProducts.FindAsync(id); if (shopBridgeProduct == null) { return(NotFound()); } return(Ok(shopBridgeProduct)); }
public async Task <IHttpActionResult> PostShopBridgeProduct(ShopBridgeProduct shopBridgeProduct) { //if (!ModelState.IsValid) //{ // return BadRequest(ModelState); //} db.ShopBridgeProducts.Add(shopBridgeProduct); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = shopBridgeProduct.ProductId }, shopBridgeProduct)); }
public async Task <IHttpActionResult> DeleteShopBridgeProduct(int id) { ShopBridgeProduct shopBridgeProduct = await db.ShopBridgeProducts.FindAsync(id); if (shopBridgeProduct == null) { return(NotFound()); } db.ShopBridgeProducts.Remove(shopBridgeProduct); await db.SaveChangesAsync(); return(Ok(shopBridgeProduct)); }