public void ReadDataFromFileCsv() { var read = new ReadCSV(); var electionDataList = read.ReadDataFromCSVFile(); electionScoreCollection.InsertMany(electionDataList); }
public void GetAllScoreParty() { var read = new ReadCSV(); var electionDataList = read.ReadDataFromCSVFile(); var totalPartyScore = new List <PartyScoreModel>(); var electionPartGroup = electionDataList.GroupBy(it => it.NameParty).ToList(); foreach (var item in electionPartGroup) { totalPartyScore.Add( new PartyScoreModel { Id = Guid.NewGuid().ToString(), NameParty = item.Key, TotalScore = item.Sum(it => it.Score) }); } partyScoreCollection.InsertMany(totalPartyScore); }
public List <ElectionModel> test() { var read = new ReadCSV(); return(read.ReadDataFromCSVFile()); }