public async Task <ActionResult <CarCopy> > PostCarCopy(CarCopy carCopy) { _context.CarCopies.Add(carCopy); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCarCopy", new { id = carCopy.Id }, carCopy)); }
public async Task <IActionResult> PutCarCopy(int id, CarCopy carCopy) { if (id != carCopy.Id) { return(BadRequest()); } _context.Entry(carCopy).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CarCopyExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }