public async Task <IActionResult> PutBikesInShop(int id, BikesInShop bikesInShop) { if (id != bikesInShop.BikesInShopId) { return(BadRequest()); } _context.Entry(bikesInShop).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BikesInShopExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <BikesInShop> > PostBikesInShop(BikesInShop bikesInShop) { _context.BikesInShops.Add(bikesInShop); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (BikesInShopExists(bikesInShop.BikesInShopId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetBikesInShop", new { id = bikesInShop.BikesInShopId }, bikesInShop)); }