public async Task <IActionResult> PutDriver(int?id, Driver update)
        {
            Driver driver;

            try
            {
                driver = await _context.drivers.FindAsync(id);

                _context.Entry(driver).State = EntityState.Detached;
            }
            catch (PostgresException e)
            {
                throw new NpgsqlException("Błąd serwera SQL - " + e.MessageText + " (kod " + e.SqlState + ")");
            }

            if (driver != null)
            {
                foreach (PropertyInfo pi in typeof(Driver).GetProperties())
                {
                    if ((pi.GetValue(update) != pi.GetValue(driver)) && (pi.GetValue(update) != null))
                    {
                        _context.Entry(update).Property(pi.Name).IsModified = true;
                    }
                    else if (pi.Name.Equals("id"))
                    {
                        update.id = id;
                    }
                }
            }
            else
            {
                return(NotFound("Nie znaleziono"));
            }

            try
            {
                await _context.SaveChangesAsync();

                _context.Entry(update).State = EntityState.Detached;
                driver = await _context.drivers.FindAsync(id);
            }
            catch (DbUpdateConcurrencyException e)
            {
                throw new DbUpdateConcurrencyException("Błąd podczas aktualizacji bazy danych - " + e.Message);
            }

            return(Ok(driver));
        }