public async Task <IActionResult> PutCollection(int id, Collection collection) { if (id != collection.Id) { return(BadRequest()); } _context.Entry(collection).State = EntityState.Modified; //int? newId = _context.Collections.Where(c => c.Name == collection.Name).FirstOrDefault().Id; //if (newId != null) // return NotFound(); try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CollectionExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutCosmType(int id, CosmType cosmType) { if (id != cosmType.Id) { return(BadRequest()); } _context.Entry(cosmType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CosmTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutStock(int id, Stock stock) { if (id != stock.Id) { return(BadRequest()); } _context.Entry(stock).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StockExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutProduct(int id, Product product) { if (id != product.Id) { return(BadRequest()); } _context.Entry(product).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }