/// <summary> /// Removes the car from the list of available cars /// </summary> /// <param name="carId">The car id to delete</param> /// <returns>True if the car is successfully added, otherwise - false</returns> public bool RemoveCar(int carId) { var car = _availableCars.FirstOrDefault(carModel => carModel.CarId == carId); if (car == null) { return(false); } _availableCars.Remove(car); CarListUpdatedAction?.Invoke(); return(true); }
/// <summary> /// Adds thew new car to the list of available cars /// </summary> /// <param name="carModel">The model of the current car</param> /// <returns>True if the car is successfully added, otherwise - false</returns> public void AddNewCar(CarModel carModel) { _availableCars.Add(carModel); CarListUpdatedAction?.Invoke(); }