Beispiel #1
0
        public void AddMockScore()
        {
            var getArea = AreaCollection.Find(it => true).ToList();
            var rnd     = new Random();

            foreach (var item in getArea)
            {
                item.ScoreReceive.Add(new DataScore
                {
                    DateElection = new DateTime(2019, 1, 28),
                    Score        = rnd.Next(1000, 3000)
                });
            }
            AreaCollection.DeleteMany(it => true);
            AreaCollection.InsertMany(getArea);
        }
Beispiel #2
0
        public void AddMockData()
        {
            AreaCollection.DeleteMany(it => true);
            var csvReader = new ReadCsv();
            var dataFile1 = csvReader.GetFile1();
            var areaDatas = csvReader.GetFile2();

            foreach (var data in areaDatas)
            {
                if (dataFile1.Any(it => it.IDProvince == data.IDProvince && it.NameParty == data.NameParty))
                {
                    var getFile1 = dataFile1.Find(it => it.IDProvince == data.IDProvince && it.NameParty == data.NameParty);
                    data.NameRegister = getFile1.NameRegister;
                    data.NoRegister   = getFile1.NoRegister;
                    data.Status       = true;
                    data.ScoreReceive = new List <DataScore>();
                }
                else
                {
                    data.Status = false;
                }
            }
            AreaCollection.InsertMany(areaDatas);
        }