Beispiel #1
0
        static void Main(string[] args)
        {
            var json       = File.ReadAllText("imot.bg-raw-data-2020-07-23.json");
            var properties = JsonSerializer.Deserialize <IEnumerable <JsonProperty> >(json);
            var db         = new RealEstateDbContext();
            IPropertiesService propertiesService = new PropertiesService(db);

            foreach (var property in properties.Where(p => p.Price > 1000))
            {
                try
                {
                    propertiesService.Create(
                        property.District,
                        property.Size,
                        property.Year,
                        property.Price,
                        property.Type,
                        property.BuildingType,
                        property.Floor,
                        property.TotalFloors);
                }
                catch
                {
                }
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var    db   = new RealEstatesDbContext();
            string json = File.ReadAllText("imot.bg-raw-data-2020-07-23.json");
            var    importedProperties = JsonConvert.DeserializeObject <IEnumerable <ImportInfoDTO> >(json);

            var propService = new PropertiesService(db);

            foreach (var prop in importedProperties)
            {
                try
                {
                    propService.Create
                    (
                        prop.Size,
                        prop.Floor,
                        prop.TotalFloors,
                        prop.District,
                        prop.Year,
                        prop.Type,
                        prop.BuildingType,
                        prop.Price
                    );
                }
                catch
                {
                }
            }
        }
Beispiel #3
0
        private static void AddCustomPropertiesToDatabase(RealEstateDbContext db)
        {
            IPropertiesService propertiesService = new PropertiesService(db);

            propertiesService.Create(125, 6, 6, "Дианабад", "4-СТАЕН", "Tyxла", 2021, 2000000);

            propertiesService.UpdateTags(1);
            propertiesService.UpdateTags(2);
            propertiesService.UpdateTags(3);
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            var db         = new RealEstateDBContext();
            var newServise = new PropertiesService(db);

            var json = File.ReadAllText("imot.bg-raw-data-2020-07-23.json");
            var data = JsonSerializer.Deserialize <JsonProperty[]>(json);

            foreach (var item in data)
            {
                newServise.Create(item.District, item.Size, item.Year, item.Price, item.Type, item.BuildingType, item.Floor, item.TotalFloors);
            }
        }
        static void Main(string[] args)
        {
            var db = new RealEstateDbContext();
            var propertiesService = new PropertiesService(db);

            File.Create("imot-raw-data.json");
            var json       = File.ReadAllText("imot-raw-data.json");
            var properties = JsonSerializer.Deserialize <IEnumerable <JsonProperty> >(json);

            foreach (var property in properties.Where(x => x.Price > 500))
            {
                propertiesService
                .Create(property.District,
                        property.Size,
                        property.Year,
                        property.Price,
                        property.Type,
                        property.BuildingType,
                        property.Floor,
                        property.TotalFloors);
            }
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            string inputJson = File.ReadAllText("imot.bg-raw-data-2020-07-23.json");

            JsonProperty[] properties = JsonConvert.DeserializeObject <JsonProperty[]>(inputJson);

            var db = new RealEstateDbContext();
            IPropertiesService propertiesService = new PropertiesService(db);

            foreach (var property in properties.Where(x => x.Price > 15000))
            {
                propertiesService.Create(
                    property.District,
                    property.Size,
                    property.Year,
                    property.Price,
                    property.Type,
                    property.BuildingType,
                    property.Floor,
                    property.TotalFloors
                    );
            }
        }