public async Task <IActionResult> PutVehicle(int id, Vehicle vehicle) { if (id != vehicle.Id) { return(BadRequest()); } _context.Entry(vehicle).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VehicleExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Service> > PutUser(int id, Service service) { if (id != service.Id) { return(BadRequest()); } _context.Entry(service).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) //można zaimplementować loggera, jeżeli wywali nam jakiś inny błąd to wszstko zalogujemy do txt { if (!ServiceExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }