public GetBirthDayPeopleDetailsResponse GetBirthdaysFilteringByLastName(string lastName)
        {
            var peoplelist = csvReaderWrapper.ReadFromBirthDayCsvFile()
                             .FindAll(x => x.LastName == lastName);

            return(BuildGetBirthdayPeopleDetailsResponse(peoplelist));
        }
Ejemplo n.º 2
0
        public void WriteToBirthdayCsvFile(BirthdayPerson birthdayPerson)
        {
            var currentRecords = csvReaderWrapper.ReadFromBirthDayCsvFile();

            currentRecords.Add(birthdayPerson);

            using (var stream = new StreamWriter(configurationWrapper.GetBirthdayCsvFilePath()))
                using (var writer = new CsvWriter(stream, new CultureInfo("EN")))
                {
                    writer.Configuration.HasHeaderRecord = true;
                    writer.WriteRecords(currentRecords);
                }
        }