public async Task <IActionResult> Putshop(long id, shop shop) { if (id != shop.Id) { return(BadRequest()); } _context.Entry(shop).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!shopExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Putgood(long idS, long idG, good good) { var Shop = await _context.Shops.FindAsync(idS); if (Shop == null) { return(BadRequest()); } var currentGood = Shop.Goods.FirstOrDefault(g => g.Id == idG); int index = Shop.Goods.IndexOf(currentGood); Shop.Goods.Remove(currentGood); Shop.Goods.Insert(index, good); await _context.SaveChangesAsync(); return(NoContent()); }