public async Task <ActionResult <AvailableColor> > PostAvailableColor(AvailableColor availableColor) { _context.AvailableColors.Add(availableColor); await _context.SaveChangesAsync(); return(CreatedAtAction("GetAvailableColor", new { id = availableColor.Id }, availableColor)); }
public async Task <IActionResult> PutAvailableColor(int id, AvailableColor availableColor) { if (id != availableColor.Id) { return(BadRequest()); } _context.Entry(availableColor).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AvailableColorExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }