54 lines
1.9 KiB
C#
54 lines
1.9 KiB
C#
using MeetTheTeacher.Model;
|
|
|
|
namespace MeetTheTeacher.Import;
|
|
|
|
/// <summary>
|
|
/// Imports <see cref="Teacher" /> data from CSV files
|
|
/// </summary>
|
|
/// <inheritdoc cref="ITeacherDataImporter" />
|
|
public sealed class TeacherDataCsvImporter : ITeacherDataImporter
|
|
{
|
|
private readonly string _businessCardDataFilePath;
|
|
private readonly string _generalDataFilePath;
|
|
|
|
/// <summary>
|
|
/// Creates a new instance of <see cref="TeacherDataCsvImporter" /> configured to read from the given files
|
|
/// </summary>
|
|
/// <param name="generalDataFilePath">Path to file containing general <see cref="Teacher" /> data for all teachers</param>
|
|
/// <param name="businessCardDataFilePath">
|
|
/// Path to file containing additional data for <see cref="TeacherWithBusinessCard" /> teachers
|
|
/// </param>
|
|
public TeacherDataCsvImporter(string generalDataFilePath, string businessCardDataFilePath)
|
|
{
|
|
_generalDataFilePath = generalDataFilePath;
|
|
_businessCardDataFilePath = businessCardDataFilePath;
|
|
}
|
|
|
|
public IEnumerable<Teacher> LoadTeacherData()
|
|
{
|
|
// TODO
|
|
return null!;
|
|
}
|
|
|
|
private static Dictionary<string, Teacher> CombineData(Dictionary<string, Teacher> generalData,
|
|
IEnumerable<(string name, int id)> businessCardData)
|
|
{
|
|
// Note: this method is designed specifically to force you to deal with the dictionary and
|
|
// different teacher classes as value. It could be done in different ways as well, of course.
|
|
|
|
// TODO
|
|
return null!;
|
|
}
|
|
|
|
private IEnumerable<(string name, int id)>? ReadTeacherBusinessCardData()
|
|
{
|
|
// TODO - CSV import (mind the return type: ValueTuple!)
|
|
return null!;
|
|
}
|
|
|
|
private Dictionary<string, Teacher>? ReadTeacherData()
|
|
{
|
|
// TODO - CSV import
|
|
return null!;
|
|
}
|
|
}
|