private async Task UpdateCar(Guid vehicleId, CarUpdated vehicleUpdated) { var databaseVehicle = await _carRepository.Get(vehicleId); if (databaseVehicle is not null) { await _carRepository.Update(_mapper.Map(vehicleUpdated, databaseVehicle)); } }
public static ICar UpdateCar(int tournamentID, ICar car) { IRlmRepository repo = RepositoryManager.GetDefaultRepository(); Car updatedCar = null; lock (_lock) { Tournament tournament = repo.LoadTournament(tournamentID); updatedCar = tournament.CarData.Where(c => c.ID == car.ID).SingleOrDefault(); updatedCar.CopyFrom(car); repo.SaveTournament(tournament); } CarUpdated?.Invoke(tournamentID, new CarUpdatedEventArgs(updatedCar)); StandingsUpdated?.Invoke(tournamentID, new StandingsUpdatedEventArgs(GetStandings(tournamentID))); return(updatedCar); }
protected void OnCarAdded(Car item, DatabaseServiceUpdate update) { CarUpdated?.Invoke(this, new DatabaseServiceUpdateEventArgs <Car>(item, update)); }