Beispiel #1
0
 public NormalizedDownloadResult(
     FipeReference fipeReference,
     FipeVehicleTypesEnum vehicleType,
     List <FipeVehicleBrand> brands,
     List <FipeVehicleModel> models,
     List <FipeVehicleInformation> vehicles,
     List <FipeVehiclePrice> prices)
 {
     this.FipeReference = fipeReference;
     this.VehicleType   = vehicleType;
     this.Brands        = brands.AsReadOnly();
     this.Models        = models.AsReadOnly();
     this.Vehicles      = vehicles.AsReadOnly();
     this.Prices        = prices.AsReadOnly();
 }
Beispiel #2
0
        public async Task <bool> SaveFipeReference(FipeReference fipeReference)
        {
            var fipeReferencesSelected = await this._repository.GetAllAsync <FipeReference>();

            var fipeReferencesInserted = new List <FipeReference> {
                fipeReference
            }
            .Where(x => !fipeReferencesSelected.Any(y => x.Id == y.Id))
            .ToList();

            if (fipeReferencesInserted.Count == 0)
            {
                return(false);
            }

            return(await this._repository.InsertOneAsync(fipeReferencesInserted.SingleOrDefault()));
        }